summaryrefslogtreecommitdiffhomepage
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-21 22:35:18 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-21 22:35:18 +0000
commitf43101753558a772b8317409cf542b3e3631cd13 (patch)
tree365763acc3ee1b21fcc13656fce6f069a7623e61 /shell/ash.c
parentbcceb0c5a4a6b69225ae9b748df96e013996d9d3 (diff)
httpd: optional support for partial downloads
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 167232c33..492474110 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2494,6 +2494,7 @@ pwdcmd(int argc, char **argv)
#define DQSYNTAX 1 /* in double quotes */
#define SQSYNTAX 2 /* in single quotes */
#define ARISYNTAX 3 /* in arithmetic */
+#define PSSYNTAX 4 /* prompt */
#if ENABLE_ASH_OPTIMIZE_FOR_SIZE
#define USE_SIT_FUNCTION
@@ -9886,6 +9887,9 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
smallint dblquote;
smallint oldstyle;
smallint prevsyntax; /* syntax before arithmetic */
+#if ENABLE_ASH_EXPAND_PRMT
+ smallint pssyntax; /* we are expanding a prompt string */
+#endif
int varnest; /* levels of variables expansion */
int arinest; /* levels of arithmetic expansion */
int parenlevel; /* levels of parens in arithmetic */
@@ -9910,6 +9914,11 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
dblquote = (syntax == DQSYNTAX);
oldstyle = 0;
prevsyntax = 0;
+#if ENABLE_ASH_EXPAND_PRMT
+ pssyntax = (syntax == PSSYNTAX);
+ if (pssyntax)
+ syntax = DQSYNTAX;
+#endif
varnest = 0;
arinest = 0;
parenlevel = 0;
@@ -9948,6 +9957,12 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
if (doprompt)
setprompt(2);
} else {
+#if ENABLE_ASH_EXPAND_PRMT
+ if (c == '$' && pssyntax) {
+ USTPUTC(CTLESC, out);
+ USTPUTC('\\', out);
+ }
+#endif
if (dblquote &&
c != '\\' && c != '`' &&
c != '$' && (
@@ -10780,7 +10795,7 @@ expandstr(const char *ps)
/* XXX Fix (char *) cast. */
setinputstring((char *)ps);
- readtoken1(pgetc(), DQSYNTAX, nullstr, 0);
+ readtoken1(pgetc(), PSSYNTAX, nullstr, 0);
popfile();
n.narg.type = NARG;