From f6e3b2f8a59922405f42c8bc283e0f5546c25d0e Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 11 Oct 2007 22:36:28 +0800 Subject: [ARITH] Add assignment and intmax_t support This patch adds assignment operator support in arithmetic expansions. It also changes the type used to intmax_t. --- src/mystring.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mystring.c') 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. -- cgit 1.4.1