summary refs log tree commit diff
path: root/src/mystring.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mystring.c')
-rw-r--r--src/mystring.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mystring.c b/src/mystring.c
index df1691b..b84b7e2 100644
--- a/src/mystring.c
+++ b/src/mystring.c
@@ -112,13 +112,13 @@ prefix(const char *string, const char *pfx)
 /*
  * Convert a string into an integer of type intmax_t.  Alow trailing spaces.
  */
-intmax_t atomax10(const char *s)
+intmax_t atomax(const char *s, int base)
 {
 	char *p;
 	intmax_t r;
 
 	errno = 0;
-	r = strtoimax(s, &p, 10);
+	r = strtoimax(s, &p, base);
 
 	if (errno != 0)
 		sh_error(illnum, s);
@@ -132,6 +132,11 @@ intmax_t atomax10(const char *s)
 	return r;
 }
 
+intmax_t atomax10(const char *s)
+{
+	return atomax(s, 10);
+}
+
 /*
  * Convert a string of digits to an integer, printing an error message on
  * failure.