vlclient: work with non-space whitespace
authorAndrew Deason <adeason@sinenomine.net>
Fri, 11 Jun 2010 21:51:02 +0000 (16:51 -0500)
committerDerrick Brashear <shadow@dementia.org>
Sat, 12 Jun 2010 02:10:08 +0000 (19:10 -0700)
Make vlclient work with non-space whitespace separating arguments.
This also makes it cope with a trailing newline that fgets() gives us,
making this more intuitive to use.

Change-Id: Ida4da9f997ac073a5afa6c95e1b3cec180c18e1a
Reviewed-on: http://gerrit.openafs.org/2126
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/vlserver/vlclient.c

index 3038cc0..ef70818 100644 (file)
@@ -37,6 +37,7 @@
 #endif
 #include <stdio.h>
 #include <string.h>
+#include <ctype.h>
 
 #include <afs/afsutil.h>
 #include <rx/xdr.h>
@@ -1316,14 +1317,14 @@ GetArgs(char *line, char **args, int *nargs)
     *nargs = 0;
     while (*line) {
        register char *last = line;
-       while (*line == ' ')
+       while (isspace(*line))
            line++;
-       if (*last == ' ')
+       if (isspace(*last))
            *last = 0;
        if (!*line)
            break;
        *args++ = line, (*nargs)++;
-       while (*line && *line != ' ')
+       while (*line && !isspace(*line))
            line++;
     }
 }