@@ -704,7 +704,7 @@ evalvar(char *p, int flag)
int discard;
int quoted;
- varflags = *p++;
+ varflags = *p++ & ~VSBIT;
subtype = varflags & VSTYPE;
quoted = flag & EXP_QUOTED;
@@ -60,7 +60,7 @@
char nullstr[1]; /* zero length string */
const char spcstr[] = " ";
const char snlfmt[] = "%s\n";
-const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL, '@', '=',
+const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL | VSBIT, '@', '=',
CTLQUOTEMARK, '\0' };
const char cqchars[] = {
#ifdef HAVE_FNMATCH
@@ -1333,7 +1333,7 @@ badsub:
synstack->dblquote = newsyn != BASESYNTAX;
}
- *((char *)stackblock() + typeloc) = subtype;
+ *((char *)stackblock() + typeloc) = subtype | VSBIT;
if (subtype != VSNORMAL) {
synstack->varnest++;
if (synstack->dblquote)
@@ -50,6 +50,7 @@
/* variable substitution byte (follows CTLVAR) */
#define VSTYPE 0x0f /* type of variable substitution */
#define VSNUL 0x10 /* colon--treat the empty string as unset */
+#define VSBIT 0x20 /* Ensure subtype is not zero */
/* values of VSTYPE field */
#define VSNORMAL 0x1 /* normal variable: $var or ${var} */