OSDN Git Service

find needs "c" suffix to -size.
authorRob Landley <rob@landley.net>
Sun, 20 Jul 2014 01:54:29 +0000 (20:54 -0500)
committerRob Landley <rob@landley.net>
Sun, 20 Jul 2014 01:54:29 +0000 (20:54 -0500)
lib/lib.c

index 52675d5..bda6993 100644 (file)
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -236,13 +236,13 @@ struct string_list *find_in_path(char *path, char *filename)
 // (zetta and yotta don't fit in 64 bits.)
 long atolx(char *numstr)
 {
-  char *c, *suffixes="bkmgtpe", *end;
+  char *c, *suffixes="cbkmgtpe", *end;
   long val = strtol(numstr, &c, 0);
 
   if (*c) {
     if (c != numstr && (end = strchr(suffixes, tolower(*c)))) {
-      int shift = end-suffixes;
-      if (shift--) val *= 1024L<<(shift*10);
+      int shift = end-suffixes-2;
+      if (shift >= 0) val *= 1024L<<(shift*10);
     } else {
       while (isspace(*c)) c++;
       if (*c) error_exit("not integer: %s", numstr);