diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-09 17:25:58 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-09 17:25:58 +0100 |
commit | d1df1a709f05a737d2477a08eea8c743e83f8f8f (patch) | |
tree | 090d99fabe279d87b491f4b4634a2b7e0e3c09c2 | |
parent | 740058b42bbfdab225706f8284e8d72b74a5df3b (diff) | |
download | busybox-w32-d1df1a709f05a737d2477a08eea8c743e83f8f8f.tar.gz busybox-w32-d1df1a709f05a737d2477a08eea8c743e83f8f8f.tar.bz2 busybox-w32-d1df1a709f05a737d2477a08eea8c743e83f8f8f.zip |
ash: add comment explaining last change
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/shell/ash.c b/shell/ash.c index 5381f34eb..83a8e77f9 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6756,6 +6756,10 @@ subevalvar(char *p, char *varname, int strloc, int subtype, | |||
6756 | // p, varname, strloc, subtype, startloc, varflags, quotes); | 6756 | // p, varname, strloc, subtype, startloc, varflags, quotes); |
6757 | 6757 | ||
6758 | #if BASH_PATTERN_SUBST | 6758 | #if BASH_PATTERN_SUBST |
6759 | /* For "${v/pattern/repl}", we must find the delimiter _before_ | ||
6760 | * argstr() call expands possible variable references in pattern: | ||
6761 | * think about "v=a; a=a/; echo ${v/$a/r}" case. | ||
6762 | */ | ||
6759 | repl = NULL; | 6763 | repl = NULL; |
6760 | if (subtype == VSREPLACE || subtype == VSREPLACEALL) { | 6764 | if (subtype == VSREPLACE || subtype == VSREPLACEALL) { |
6761 | /* Find '/' and replace with NUL */ | 6765 | /* Find '/' and replace with NUL */ |
@@ -6770,11 +6774,8 @@ subevalvar(char *p, char *varname, int strloc, int subtype, | |||
6770 | *repl = '\0'; | 6774 | *repl = '\0'; |
6771 | break; | 6775 | break; |
6772 | } | 6776 | } |
6773 | if ((unsigned char)*repl == CTLESC | 6777 | if ((unsigned char)*repl == CTLESC && repl[1]) |
6774 | && repl[1] | ||
6775 | ) { | ||
6776 | repl++; | 6778 | repl++; |
6777 | } | ||
6778 | repl++; | 6779 | repl++; |
6779 | } | 6780 | } |
6780 | } | 6781 | } |
@@ -6941,11 +6942,10 @@ subevalvar(char *p, char *varname, int strloc, int subtype, | |||
6941 | 6942 | ||
6942 | if (!repl) { | 6943 | if (!repl) { |
6943 | //bb_error_msg("str9:'%s' slash_pos:%d", str, slash_pos); | 6944 | //bb_error_msg("str9:'%s' slash_pos:%d", str, slash_pos); |
6945 | repl = nullstr; | ||
6944 | if (slash_pos >= 0) { | 6946 | if (slash_pos >= 0) { |
6945 | repl = str + slash_pos; | 6947 | repl = str + slash_pos; |
6946 | *repl++ = '\0'; | 6948 | *repl++ = '\0'; |
6947 | } else { | ||
6948 | repl = nullstr; | ||
6949 | } | 6949 | } |
6950 | } | 6950 | } |
6951 | //bb_error_msg("str:'%s' repl:'%s'", str, repl); | 6951 | //bb_error_msg("str:'%s' repl:'%s'", str, repl); |