diff options
author | tegge <tegge@FreeBSD.org> | 2001-09-19 20:07:47 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2001-09-19 20:07:47 +0000 |
commit | 0c39138a0b8e8641570b8e60e24b63c5226b67dd (patch) | |
tree | cccdbf82d641da8669f0615050ea9e9865a497fe /bin/sh/expand.c | |
parent | 221fff643731890a2799e1730976fa57fbd0d9c4 (diff) | |
download | FreeBSD-src-0c39138a0b8e8641570b8e60e24b63c5226b67dd.zip FreeBSD-src-0c39138a0b8e8641570b8e60e24b63c5226b67dd.tar.gz |
BASESYNTAX, DQSYNTAX, SQSYNTAX and ARISYNTAX handles negative indexes.
Allow those to be used to properly quote characters in the shell
control character range.
Diffstat (limited to 'bin/sh/expand.c')
-rw-r--r-- | bin/sh/expand.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index d82f459..f1d0d69 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 && c >= 0 && SQSYNTAX[(int)c] == CCTL) + if (quotes && 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 && lastc >= 0 && syntax[(int)lastc] == CCTL) + if (quotes && 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 && *val >= 0 && + if (quotes && 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 (*p >= 0 && syntax[(int)*p] == CCTL) \ + if (syntax[(int)*p] == CCTL) \ STPUTC(CTLESC, expdest); \ STPUTC(*p++, expdest); \ } \ |