aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-29 22:58:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-29 22:58:44 +0200
commit5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9 (patch)
treee3ce598d17b7e75bd228c5e7f0068735339bf79a
parent1c79aeb6a8cae4cd4013926b97f39305b689d74c (diff)
downloadbusybox-w32-5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9.tar.gz
busybox-w32-5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9.tar.bz2
busybox-w32-5f0a75f24b5afdedf5b67a7f42184ed196e1a5c9.zip
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 e2b4eee95..52fcc7944 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2494,7 +2494,9 @@ static const char *expandstr(const char *ps, int syntax_type);
2494#define DQSYNTAX 1 /* in double quotes */ 2494#define DQSYNTAX 1 /* in double quotes */
2495#define SQSYNTAX 2 /* in single quotes */ 2495#define SQSYNTAX 2 /* in single quotes */
2496#define ARISYNTAX 3 /* in arithmetic */ 2496#define ARISYNTAX 3 /* in arithmetic */
2497#define PSSYNTAX 4 /* prompt. never passed to SIT() */ 2497#if ENABLE_ASH_EXPAND_PRMT
2498# define PSSYNTAX 4 /* prompt. never passed to SIT() */
2499#endif
2498/* PSSYNTAX expansion is identical to DQSYNTAX, except keeping '\$' as '\$' */ 2500/* PSSYNTAX expansion is identical to DQSYNTAX, except keeping '\$' as '\$' */
2499 2501
2500/* 2502/*
@@ -11594,9 +11596,13 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11594 bqlist = NULL; 11596 bqlist = NULL;
11595 quotef = 0; 11597 quotef = 0;
11596 IF_FEATURE_SH_MATH(prevsyntax = 0;) 11598 IF_FEATURE_SH_MATH(prevsyntax = 0;)
11599#if ENABLE_ASH_EXPAND_PRMT
11597 pssyntax = (syntax == PSSYNTAX); 11600 pssyntax = (syntax == PSSYNTAX);
11598 if (pssyntax) 11601 if (pssyntax)
11599 syntax = DQSYNTAX; 11602 syntax = DQSYNTAX;
11603#else
11604 pssyntax = 0; /* constant */
11605#endif
11600 dblquote = (syntax == DQSYNTAX); 11606 dblquote = (syntax == DQSYNTAX);
11601 varnest = 0; 11607 varnest = 0;
11602 IF_FEATURE_SH_MATH(arinest = 0;) 11608 IF_FEATURE_SH_MATH(arinest = 0;)
@@ -11650,7 +11656,7 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11650 } else if (c == '\n') { 11656 } else if (c == '\n') {
11651 nlprompt(); 11657 nlprompt();
11652 } else { 11658 } else {
11653 if (c == '$' && pssyntax) { 11659 if (pssyntax && c == '$') {
11654 USTPUTC(CTLESC, out); 11660 USTPUTC(CTLESC, out);
11655 USTPUTC('\\', out); 11661 USTPUTC('\\', out);
11656 } 11662 }