- use skip_non_whitespace() where appropriate
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 10 Apr 2007 09:38:35 +0000 (09:38 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tue, 10 Apr 2007 09:38:35 +0000 (09:38 -0000)
coreutils/uniq.c
miscutils/dc.c
shell/bbsh.c

index bcdf44026dde46e2189239d0a8daadf717669b02..11a731aaa5f9a7e6d3c4d03f610bae848a258084 100644 (file)
@@ -75,9 +75,7 @@ int uniq_main(int argc, char **argv)
                        e1 = s1;
                        for (i = skip_fields; i; i--) {
                                e1 = skip_whitespace(e1);
-                               while (*e1 && !isspace(*e1)) {
-                                       ++e1;
-                               }
+                               e1 = skip_non_whitespace(e1);
                        }
                        for (i = skip_chars; *e1 && i; i--) {
                                ++e1;
index 8c9d77fc36dcf098d0214bae05a63c63dda1c07b..1953a9489e0c32a00371c4ca3b0b5333cfe77d97 100644 (file)
@@ -182,9 +182,7 @@ static char *get_token(char **buffer)
        current = skip_whitespace(*buffer);
        if (*current != 0) {
                start = current;
-               while (!isspace(*current) && *current != 0) {
-                       current++;
-               }
+               current = skip_non_whitespace(current);
                *buffer = current;
        }
        return start;
index 4f38213c99bfe260585afbfc9cb980748a1f77b7..06fd0131e688c71e6edf39715bcda877f94e8482 100644 (file)
@@ -90,7 +90,7 @@ static char *parse_word(char *start, struct command **cmd)
 
        // Grab next word.  (Add dequote and envvar logic here)
        end = start;
-       while (*end && !isspace(*end)) end++;
+       end = skip_non_whitespace(end);
        (*cmd)->argv[(*cmd)->argc++] = xstrndup(start, end-start);
 
        // Allocate more space if there's no room for NULL terminator.