BASESYNTAX, DQSYNTAX, SQSYNTAX and ARISYNTAX handles negative indexes.
Allow those to be used to properly quote characters in the shell control character range.
This commit is contained in:
parent
5f2359b374
commit
0c4eedda7b
@ -315,7 +315,7 @@ exptilde(p, flag)
|
||||
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 @@ evalvar(p, flag)
|
||||
}
|
||||
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); \
|
||||
} \
|
||||
|
@ -977,7 +977,7 @@ readtoken1(firstc, syntax, eofmark, striptabs)
|
||||
c != '`' && c != '$' &&
|
||||
(c != '"' || eofmark != NULL))
|
||||
USTPUTC('\\', out);
|
||||
if (c >= 0 && SQSYNTAX[c] == CCTL)
|
||||
if (SQSYNTAX[c] == CCTL)
|
||||
USTPUTC(CTLESC, out);
|
||||
else if (eofmark == NULL)
|
||||
USTPUTC(CTLQUOTEMARK, out);
|
||||
@ -1496,7 +1496,7 @@ noexpand(text)
|
||||
continue;
|
||||
if (c == CTLESC)
|
||||
p++;
|
||||
else if (c >= 0 && BASESYNTAX[(int)c] == CCTL)
|
||||
else if (BASESYNTAX[(int)c] == CCTL)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user