static void reap(pid_t pid)
{
int status;
- for (;;) {
- if (waitpid(pid, &status, 0) < 0) {
- if (errno != EINTR) return;
- } else {
- if (WIFEXITED(status)) return;
- }
- }
+ while (waitpid(pid, &status, 0) < 0 && errno == EINTR);
}
static char *getword(FILE *f)
if (flags & WRDE_NOCMD) for (i=0; s[i]; i++) switch (s[i]) {
case '\\':
- if (!sq) i++;
+ if (!sq && !s[++i]) return WRDE_SYNTAX;
break;
case '\'':
if (!dq) sq^=1;