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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mystring.c b/src/mystring.c
index 8e1200a..ce48c82 100644
--- a/src/mystring.c
+++ b/src/mystring.c
@@ -108,6 +108,10 @@ prefix(const char *string, const char *pfx)
 	return (char *) string;
 }
 
+void badnum(const char *s)
+{
+	sh_error(illnum, s);
+}
 
 /*
  * Convert a string into an integer of type intmax_t.  Alow trailing spaces.
@@ -121,20 +125,20 @@ intmax_t atomax(const char *s, int base)
 	r = strtoimax(s, &p, base);
 
 	if (errno != 0)
-		sh_error(illnum, s);
+		badnum(s);
 
 	/*
 	 * Disallow completely blank strings in non-arithmetic (base != 0)
 	 * contexts.
 	 */
-	if (base && (p == s))
-		sh_error(illnum, s);
+	if (p == s && base)
+		badnum(s);
 
 	while (isspace((unsigned char)*p))
 	      p++;
 
 	if (*p)
-		sh_error(illnum, s);
+		badnum(s);
 
 	return r;
 }
@@ -155,7 +159,7 @@ number(const char *s)
 	intmax_t n = atomax10(s);
 
 	if (n < 0 || n > INT_MAX)
-		sh_error(illnum, s);
+		badnum(s);
 
 	return n;
 }
class='nohover-highlight'> 2019-06-07Add variables to bitJune McEnroe 2019-06-05Add A Closed and Common OrbitJune McEnroe 2019-06-02Add RebornJune McEnroe 2019-05-30Add bit to bin.7June McEnroe 2019-05-30Simplify and build bitJune McEnroe lex is a waste of time. 2019-05-29Add xx -p optionJune McEnroe 2019-05-27Add FrontierJune McEnroe 2019-05-27Break nicks with ZWNJJune McEnroe This should prevent bad wrapping. 2019-05-26Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe who the fuck is scraeming "#define _GNU_SOURCE" at my house. show yourself, coward. i will never #define _GNU_SOURCE 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe Their %-prefixed directives should probably be highlighted Macro. 2019-05-10Use val instead of suboptargJune McEnroe suboptarg doesn't exist in GNU. Hopefully BSD getsubopt also sets val on failure? 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe Need to do some stuff in the Makefile for lex and yacc and generating HTML pages for it. 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe