diff --git a/src/makeint.h b/src/makeint.h index 015bf5c2..fcfb7bdf 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -463,8 +463,8 @@ extern int unixy_shell; #define ISBLANK(c) STOP_SET((c),MAP_BLANK) #define ISSPACE(c) STOP_SET((c),MAP_SPACE) +#define END_OF_TOKEN(c) STOP_SET((c),MAP_SPACE|MAP_NUL) #define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s) -#define END_OF_TOKEN(s) while (! STOP_SET (*(s), MAP_SPACE|MAP_NUL)) ++(s) /* We can't run setrlimit when using posix_spawn. */ #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN) diff --git a/src/misc.c b/src/misc.c index bc5060a3..3072952c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -308,7 +308,8 @@ lindex (const char *s, const char *limit, int c) char * end_of_token (const char *s) { - END_OF_TOKEN (s); + while (! END_OF_TOKEN (*s)) + ++s; return (char *)s; } diff --git a/src/read.c b/src/read.c index 3b4b0fe4..ac4dc845 100644 --- a/src/read.c +++ b/src/read.c @@ -2735,7 +2735,7 @@ get_next_mword (char *buffer, char **startp, size_t *length) char c; /* Skip any leading whitespace. */ - while (ISBLANK (*p)) + while (ISSPACE (*p)) ++p; beg = p; @@ -2821,11 +2821,11 @@ get_next_mword (char *buffer, char **startp, size_t *length) char closeparen; int count; + if (END_OF_TOKEN (c)) + goto done_word; + switch (c) { - case '\0': - case ' ': - case '\t': case '=': goto done_word;