aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-06-13 19:01:30 +0000
committerRob Landley <rob@landley.net>2006-06-13 19:01:30 +0000
commit68286770b61638b99e110051612a6ee27088b1b4 (patch)
tree23ffed53db9b0179e4983a385549d2fcf920bf68
parentf94637959902b54b2a1c44e3608fa77158856005 (diff)
downloadbusybox-w32-68286770b61638b99e110051612a6ee27088b1b4.tar.gz
busybox-w32-68286770b61638b99e110051612a6ee27088b1b4.tar.bz2
busybox-w32-68286770b61638b99e110051612a6ee27088b1b4.zip
Patch from Shaun Jackman to detect "name=value" variable assignments. Random
cleanup at the end by me to make some unrelated #ifdefs go away...
-rw-r--r--shell/lash.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/shell/lash.c b/shell/lash.c
index 216db8a7e..eebb2f8a2 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1182,9 +1182,12 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
1182static int pseudo_exec(struct child_prog *child) 1182static int pseudo_exec(struct child_prog *child)
1183{ 1183{
1184 struct built_in_command *x; 1184 struct built_in_command *x;
1185#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL 1185
1186 char *name; 1186 /* Check if the command sets an environment variable. */
1187#endif 1187 if( strchr(child->argv[0], '=') != NULL ) {
1188 child->argv[1] = child->argv[0];
1189 _exit(builtin_export(child));
1190 }
1188 1191
1189 /* Check if the command matches any of the non-forking builtins. 1192 /* Check if the command matches any of the non-forking builtins.
1190 * Depending on context, this might be redundant. But it's 1193 * Depending on context, this might be redundant. But it's
@@ -1204,7 +1207,7 @@ static int pseudo_exec(struct child_prog *child)
1204 _exit (x->function(child)); 1207 _exit (x->function(child));
1205 } 1208 }
1206 } 1209 }
1207#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL 1210
1208 /* Check if the command matches any busybox internal 1211 /* Check if the command matches any busybox internal
1209 * commands ("applets") here. Following discussions from 1212 * commands ("applets") here. Following discussions from
1210 * November 2000 on busybox@busybox.net, don't use 1213 * November 2000 on busybox@busybox.net, don't use
@@ -1216,17 +1219,15 @@ static int pseudo_exec(struct child_prog *child)
1216 * /bin/foo invocation will fork and exec /bin/foo, even if 1219 * /bin/foo invocation will fork and exec /bin/foo, even if
1217 * /bin/foo is a symlink to busybox. 1220 * /bin/foo is a symlink to busybox.
1218 */ 1221 */
1219 name = child->argv[0];
1220 1222
1221 { 1223 if (ENABLE_FEATURE_SH_STANDALONE_SHELL) {
1222 char** argv_l=child->argv; 1224 char **argv_l = child->argv;
1223 int argc_l; 1225 int argc_l;
1224 1226
1225 for(argc_l=0;*argv_l!=NULL; argv_l++, argc_l++); 1227 for(argc_l=0; *argv_l; argv_l++, argc_l++);
1226 optind = 1; 1228 optind = 1;
1227 run_applet_by_name(name, argc_l, child->argv); 1229 run_applet_by_name(child->argv[0], argc_l, child->argv);
1228 } 1230 }
1229#endif
1230 1231
1231 execvp(child->argv[0], child->argv); 1232 execvp(child->argv[0], child->argv);
1232 1233