diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-11-05 11:21:10 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-11-05 11:21:10 -0800 |
commit | 2cf9bde38908a45ec35fd0d6f6f10ebde00c69f1 (patch) | |
tree | 9e544ec8e5965627982c943f5ea5206f4283a247 | |
parent | 31cbc49a79554da90e1cab0e85b1fb62afcc0c36 (diff) | |
download | make-2cf9bde38908a45ec35fd0d6f6f10ebde00c69f1.tar.gz make-2cf9bde38908a45ec35fd0d6f6f10ebde00c69f1.tar.bz2 make-2cf9bde38908a45ec35fd0d6f6f10ebde00c69f1.zip |
fix whitespace tokenization
-rw-r--r-- | function.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -1133,19 +1133,14 @@ func_sort (char *o, char **argv, const char *funcname UNUSED) /* Find the maximum number of words we'll have. */ t = argv[0]; - wordi = 1; - while (*t != '\0') + wordi = 0; + while ((p = find_next_token (&t, &len)) != 0) { - char c = *(t++); - - if (! isspace ((unsigned char)c)) - continue; - - ++wordi; - - while (isspace ((unsigned char)*t)) - ++t; + ++t; + wordi++; } + if (! wordi) + wordi = 1; words = xmalloc (wordi * sizeof (char *)); |