# HG changeset patch # User Rob Landley # Date 1341091897 18000 # Node ID 43489d67397632275bcef4804a55997e79e08ccc # Parent 2b40588a3d25e67d760bf589ae7af4c01cd5926a Add NOP b (byte) suffix to atolx() since od needs it. diff -r 2b40588a3d25 -r 43489d673976 lib/lib.c --- a/lib/lib.c Tue Jun 26 20:47:01 2012 -0500 +++ b/lib/lib.c Sat Jun 30 16:31:37 2012 -0500 @@ -499,13 +499,15 @@ // (zetta and yotta don't fit in 64 bits.) long atolx(char *numstr) { - char *c, *suffixes="kmgtpe", *end; + char *c, *suffixes="bkmgtpe", *end; long val = strtol(numstr, &c, 0); if (*c) { end = strchr(suffixes, tolower(*c)); - if (end) val *= 1024L<<((end-suffixes)*10); - else { + if (end) { + int shift = end-suffixes; + if (shift--) val *= 1024L<<(shift*10); + } else { while (isspace(*c)) c++; if (*c) error_exit("not integer: %s", numstr); }