diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-03-09 01:24:02 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-03-09 01:24:02 +0000 |
commit | 01658a3eec87ffd81c47d908ca1a785e29a45993 (patch) | |
tree | 7942258ffc2e1861a1ef6a2c8ecb91867840c824 /shell | |
parent | 3dbf1e877af409c17092ce5d6cdcb686dad50b65 (diff) | |
download | busybox-w32-01658a3eec87ffd81c47d908ca1a785e29a45993.tar.gz busybox-w32-01658a3eec87ffd81c47d908ca1a785e29a45993.tar.bz2 busybox-w32-01658a3eec87ffd81c47d908ca1a785e29a45993.zip |
Fix sh.c for the glab case. I was messing things up for
single argument commands. It should now work as expected...
-Erik
Diffstat (limited to 'shell')
-rw-r--r-- | shell/lash.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/shell/lash.c b/shell/lash.c index ae5532e54..e1bdc875a 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -994,8 +994,8 @@ static int expand_arguments(char *command) | |||
994 | 994 | ||
995 | /* Convert from char** (one word per string) to a simple char*, | 995 | /* Convert from char** (one word per string) to a simple char*, |
996 | * but don't overflow command which is BUFSIZ in length */ | 996 | * but don't overflow command which is BUFSIZ in length */ |
997 | *command = '\0'; | ||
998 | if ( expand_result.gl_pathc > 1) { | 997 | if ( expand_result.gl_pathc > 1) { |
998 | *command = '\0'; | ||
999 | while (i < expand_result.gl_pathc && total_length < BUFSIZ) { | 999 | while (i < expand_result.gl_pathc && total_length < BUFSIZ) { |
1000 | length=strlen(expand_result.gl_pathv[i])+1; | 1000 | length=strlen(expand_result.gl_pathv[i])+1; |
1001 | if (BUFSIZ-total_length-length <= 0) { | 1001 | if (BUFSIZ-total_length-length <= 0) { |
@@ -1078,11 +1078,12 @@ static int expand_arguments(char *command) | |||
1078 | } else { | 1078 | } else { |
1079 | /* Seems we got an un-expandable variable. So delete it. */ | 1079 | /* Seems we got an un-expandable variable. So delete it. */ |
1080 | char *next_dst; | 1080 | char *next_dst; |
1081 | if ((next_dst=strpbrk(dst+1, " \t~`!$^&*()=|\\{}[];\"'<>?.")) != NULL) { | 1081 | if ((next_dst=strpbrk(dst+1, " \t~`!$^&*()=|\\{}[];\"'<>?.")) == NULL) { |
1082 | /* Move stuff to the end of the string to accommodate filling | 1082 | next_dst=dst+1+strlen(dst); |
1083 | * the created gap with the new stuff */ | ||
1084 | memmove(dst, next_dst, next_dst-dst); | ||
1085 | } | 1083 | } |
1084 | /* Move stuff to the end of the string to accommodate filling | ||
1085 | * the created gap with the new stuff */ | ||
1086 | memmove(dst, next_dst, next_dst-dst); | ||
1086 | } | 1087 | } |
1087 | } | 1088 | } |
1088 | 1089 | ||