diff options
author | msmith <msmith@FreeBSD.org> | 1999-01-10 05:08:12 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-01-10 05:08:12 +0000 |
commit | e50aa55751caccf7ccaf43d7a09795ff12967ade (patch) | |
tree | e11ac865a34abab8e4e6ebe08186e961136cc3b3 | |
parent | 25a87c9b4297bdb1834d99f5e00eac4185a09477 (diff) | |
download | FreeBSD-src-e50aa55751caccf7ccaf43d7a09795ff12967ade.zip FreeBSD-src-e50aa55751caccf7ccaf43d7a09795ff12967ade.tar.gz |
Enable escapes for $ to make it possible to insert variable names into
other variable values.
-rw-r--r-- | sys/boot/common/interp_backslash.c | 5 | ||||
-rw-r--r-- | sys/boot/common/interp_parse.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/boot/common/interp_backslash.c b/sys/boot/common/interp_backslash.c index 8807fdaa..6de118e 100644 --- a/sys/boot/common/interp_backslash.c +++ b/sys/boot/common/interp_backslash.c @@ -11,7 +11,7 @@ * Jordan K. Hubbard * 29 August 1998 * - * $Id: interp_backslash.c,v 1.1 1998/09/01 00:41:24 msmith Exp $ + * $Id: interp_backslash.c,v 1.2 1998/09/03 06:14:41 jkh Exp $ * * Routine for doing backslash elimination. */ @@ -52,9 +52,10 @@ backslash(char *str) str++; break; - /* preserve backslashed quotes */ + /* preserve backslashed quotes, dollar signs */ case '\'': case '"': + case '$': new_str[i++] = '\\'; new_str[i++] = *str++; break; diff --git a/sys/boot/common/interp_parse.c b/sys/boot/common/interp_parse.c index ef23563..a450f7d 100644 --- a/sys/boot/common/interp_parse.c +++ b/sys/boot/common/interp_parse.c @@ -11,7 +11,7 @@ * Jordan K. Hubbard * 29 August 1998 * - * $Id: interp_parse.c,v 1.3 1998/09/04 02:43:26 msmith Exp $ + * $Id: interp_parse.c,v 1.4 1998/09/17 23:52:02 msmith Exp $ * * The meat of the simple parser. */ @@ -100,7 +100,11 @@ parse(int *argc, char ***argv, char *str) while (*p) { switch (state) { case STR: - if (isquote(*p)) { + if ((*p == '\\') && p[1]) { + p++; + PARSE_FAIL(i == (PARSE_BUFSIZE - 1)); + buf[i] = *p++; + } else if (isquote(*p)) { quote = quote ? 0 : *p; ++p; } |