diff options
author | cracauer <cracauer@FreeBSD.org> | 1999-12-15 11:46:32 +0000 |
---|---|---|
committer | cracauer <cracauer@FreeBSD.org> | 1999-12-15 11:46:32 +0000 |
commit | ea70a76b310978e21752eda8780f2e5c3a284bca (patch) | |
tree | a4dc1e787d43553feffe5698a260b38045127e69 /bin/sh | |
parent | fc793cf05b0b81793cfba6c8e586da1b80267149 (diff) | |
download | FreeBSD-src-ea70a76b310978e21752eda8780f2e5c3a284bca.zip FreeBSD-src-ea70a76b310978e21752eda8780f2e5c3a284bca.tar.gz |
First round of 8-bit fixes.
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/expand.c | 8 | ||||
-rw-r--r-- | bin/sh/mksyntax.c | 2 | ||||
-rw-r--r-- | bin/sh/parser.c | 9 |
3 files changed, 10 insertions, 9 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 5a1b57d..00c5f09 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -315,7 +315,7 @@ done: goto lose; *p = c; while ((c = *home++) != '\0') { - if (quotes && SQSYNTAX[(int)c] == CCTL) + if (quotes && c >= 0 && SQSYNTAX[(int)c] == CCTL) STPUTC(CTLESC, expdest); STPUTC(c, expdest); } @@ -478,7 +478,7 @@ expbackq(cmd, quoted, flag) } lastc = *p++; if (lastc != '\0') { - if (quotes && syntax[(int)lastc] == CCTL) + if (quotes && lastc >= 0 && syntax[(int)lastc] == CCTL) STPUTC(CTLESC, dest); STPUTC(lastc, dest); } @@ -694,7 +694,7 @@ again: /* jump here after setting a variable with ${var=text} */ } else { while (*val) { - if (quotes && + if (quotes && *val >= 0 && syntax[(int)*val] == CCTL) STPUTC(CTLESC, expdest); STPUTC(*val++, expdest); @@ -866,7 +866,7 @@ varvalue(name, quoted, allow_split) if (allow_split) { \ syntax = quoted? DQSYNTAX : BASESYNTAX; \ while (*p) { \ - if (syntax[(int)*p] == CCTL) \ + if (*p >= 0 && syntax[(int)*p] == CCTL) \ STPUTC(CTLESC, expdest); \ STPUTC(*p++, expdest); \ } \ diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 8e4ab08..3f7f8cb 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -350,7 +350,7 @@ print(name) */ static char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)", + "#define is_digit(c)\t((c >= 0 && is_type+SYNBASE)[c] & ISDIGIT)", "#define is_alpha(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && isalpha((unsigned char) (c)))", "#define is_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalpha((unsigned char) (c))))", "#define is_in_name(c)\t((c) != PEOF && ((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalnum((unsigned char) (c))))", diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 505cf16..d734066 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -937,10 +937,11 @@ readtoken1(firstc, syntax, eofmark, striptabs) else setprompt(0); } else { - if (dblquote && c != '\\' && c != '`' && c != '$' - && (c != '"' || eofmark != NULL)) + if (dblquote && c != '\\' && + c != '`' && c != '$' && + (c != '"' || eofmark != NULL)) USTPUTC('\\', out); - if (SQSYNTAX[c] == CCTL) + if (c >= 0 && SQSYNTAX[c] == CCTL) USTPUTC(CTLESC, out); else if (eofmark == NULL) USTPUTC(CTLQUOTEMARK, out); @@ -1457,7 +1458,7 @@ noexpand(text) continue; if (c == CTLESC) p++; - else if (BASESYNTAX[(int)c] == CCTL) + else if (c >= 0 && BASESYNTAX[(int)c] == CCTL) return 0; } return 1; |