summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-29 22:58:44 +0200
committerDenys Vlasenko2017-07-29 22:58:44 +0200
commit5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9 (patch)
treee3ce598d17b7e75bd228c5e7f0068735339bf79a
parent1c79aeb6a8cae4cd4013926b97f39305b689d74c (diff)
downloadbusybox-5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9.zip
busybox-5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9.tar.gz
ash: if !ENABLE_ASH_EXPAND_PRMT, disable PSSYNTAX code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index e2b4eee..52fcc79 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2494,7 +2494,9 @@ static const char *expandstr(const char *ps, int syntax_type);
#define DQSYNTAX 1 /* in double quotes */
#define SQSYNTAX 2 /* in single quotes */
#define ARISYNTAX 3 /* in arithmetic */
-#define PSSYNTAX 4 /* prompt. never passed to SIT() */
+#if ENABLE_ASH_EXPAND_PRMT
+# define PSSYNTAX 4 /* prompt. never passed to SIT() */
+#endif
/* PSSYNTAX expansion is identical to DQSYNTAX, except keeping '\$' as '\$' */
/*
@@ -11594,9 +11596,13 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
bqlist = NULL;
quotef = 0;
IF_FEATURE_SH_MATH(prevsyntax = 0;)
+#if ENABLE_ASH_EXPAND_PRMT
pssyntax = (syntax == PSSYNTAX);
if (pssyntax)
syntax = DQSYNTAX;
+#else
+ pssyntax = 0; /* constant */
+#endif
dblquote = (syntax == DQSYNTAX);
varnest = 0;
IF_FEATURE_SH_MATH(arinest = 0;)
@@ -11650,7 +11656,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
} else if (c == '\n') {
nlprompt();
} else {
- if (c == '$' && pssyntax) {
+ if (pssyntax && c == '$') {
USTPUTC(CTLESC, out);
USTPUTC('\\', out);
}