From: Matt Kraai Date: Thu, 14 Sep 2000 00:43:20 +0000 (-0000) Subject: Backslashes shouldn't be treated as backticks. X-Git-Tag: 0_47~78 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=131241f71cbb6e0dd997fc1f65a6a4f3c8b9d625;p=oweals%2Fbusybox.git Backslashes shouldn't be treated as backticks. --- diff --git a/lash.c b/lash.c index b4b11fb89..7bc43190d 100644 --- a/lash.c +++ b/lash.c @@ -1003,16 +1003,6 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi returnCommand = *commandPtr + (src - *commandPtr) + 1; break; - case '\\': - src++; - if (!*src) { - errorMsg("character expected after \\\n"); - freeJob(job); - return 1; - } - if (*src == '*' || *src == '[' || *src == ']' - || *src == '?') *buf++ = '\\'; - /* fallthrough */ #ifdef BB_FEATURE_SH_BACKTICKS case '`': /* Exec a backtick-ed command */ @@ -1082,6 +1072,17 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi } break; #endif // BB_FEATURE_SH_BACKTICKS + + case '\\': + src++; + if (!*src) { + errorMsg("character expected after \\\n"); + freeJob(job); + return 1; + } + if (*src == '*' || *src == '[' || *src == ']' + || *src == '?') *buf++ = '\\'; + /* fallthrough */ default: *buf++ = *src; } diff --git a/sh.c b/sh.c index b4b11fb89..7bc43190d 100644 --- a/sh.c +++ b/sh.c @@ -1003,16 +1003,6 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi returnCommand = *commandPtr + (src - *commandPtr) + 1; break; - case '\\': - src++; - if (!*src) { - errorMsg("character expected after \\\n"); - freeJob(job); - return 1; - } - if (*src == '*' || *src == '[' || *src == ']' - || *src == '?') *buf++ = '\\'; - /* fallthrough */ #ifdef BB_FEATURE_SH_BACKTICKS case '`': /* Exec a backtick-ed command */ @@ -1082,6 +1072,17 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi } break; #endif // BB_FEATURE_SH_BACKTICKS + + case '\\': + src++; + if (!*src) { + errorMsg("character expected after \\\n"); + freeJob(job); + return 1; + } + if (*src == '*' || *src == '[' || *src == ']' + || *src == '?') *buf++ = '\\'; + /* fallthrough */ default: *buf++ = *src; } diff --git a/shell/lash.c b/shell/lash.c index b4b11fb89..7bc43190d 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -1003,16 +1003,6 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi returnCommand = *commandPtr + (src - *commandPtr) + 1; break; - case '\\': - src++; - if (!*src) { - errorMsg("character expected after \\\n"); - freeJob(job); - return 1; - } - if (*src == '*' || *src == '[' || *src == ']' - || *src == '?') *buf++ = '\\'; - /* fallthrough */ #ifdef BB_FEATURE_SH_BACKTICKS case '`': /* Exec a backtick-ed command */ @@ -1082,6 +1072,17 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi } break; #endif // BB_FEATURE_SH_BACKTICKS + + case '\\': + src++; + if (!*src) { + errorMsg("character expected after \\\n"); + freeJob(job); + return 1; + } + if (*src == '*' || *src == '[' || *src == ']' + || *src == '?') *buf++ = '\\'; + /* fallthrough */ default: *buf++ = *src; }