diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-11-17 18:07:30 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-11-17 18:07:30 +0000 |
commit | 50b3113dc2d7056d34e053826cb2d23327c99803 (patch) | |
tree | c0c5859b8b8182c0c11e2662cdead1ca10fc38d8 | |
parent | 337ec1bb321830df27af594f50995ef1de47cd55 (diff) | |
download | busybox-w32-50b3113dc2d7056d34e053826cb2d23327c99803.tar.gz busybox-w32-50b3113dc2d7056d34e053826cb2d23327c99803.tar.bz2 busybox-w32-50b3113dc2d7056d34e053826cb2d23327c99803.zip |
Add in a new FEATURE (off by default) BB_FEATURE_SH_BUILTINS_ALWAYS_WIN.
Make the sh default to using external commands when a path is provided.
-rw-r--r-- | Config.h | 8 | ||||
-rw-r--r-- | lash.c | 19 | ||||
-rw-r--r-- | sh.c | 19 | ||||
-rw-r--r-- | shell/lash.c | 19 |
4 files changed, 62 insertions, 3 deletions
@@ -234,6 +234,14 @@ | |||
234 | //among other thing. | 234 | //among other thing. |
235 | #define BB_FEATURE_SH_STANDALONE_SHELL | 235 | #define BB_FEATURE_SH_STANDALONE_SHELL |
236 | // | 236 | // |
237 | //When this is enabled, busybox shell builtins can be called using full path | ||
238 | //names. This causes builtins (which includes every single busybox command | ||
239 | //when you enable BB_FEATURE_SH_STANDALONE_SHELL) to override real commands on | ||
240 | //the filesystem. When this is enabled, if you run /bin/cat, it will use | ||
241 | //BusyBox cat even if /bin/cat exists on the filesystem and is _not_ busybox. | ||
242 | //Some systems want this, others do not. Choose wisely. :-) | ||
243 | //BB_FEATURE_SH_BUILTINS_ALWAYS_WIN | ||
244 | // | ||
237 | // Enable tab completion in the shell (not yet | 245 | // Enable tab completion in the shell (not yet |
238 | // working very well -- so don't turn this on) | 246 | // working very well -- so don't turn this on) |
239 | //#define BB_FEATURE_SH_TAB_COMPLETION | 247 | //#define BB_FEATURE_SH_TAB_COMPLETION |
@@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1217 | /* Check if the command matches any busybox internal commands here */ | 1217 | /* Check if the command matches any busybox internal commands here */ |
1218 | while (a->name != 0) { | 1218 | while (a->name != 0) { |
1219 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | 1219 | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN |
1220 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||
1221 | a->name) == 0) | ||
1222 | #else | ||
1223 | /* Check if the command matches any busybox internal | ||
1224 | * commands ("applets") here. Following discussions from | ||
1225 | * November 2000 on busybox@opensource.lineo.com, don't use | ||
1226 | * get_last_path_component(). This way explicit (with | ||
1227 | * slashes) filenames will never be interpreted as an | ||
1228 | * applet, just like with builtins. This way the user can | ||
1229 | * override an applet with an explicit filename reference. | ||
1230 | * The only downside to this change is that an explicit | ||
1231 | * /bin/foo invocation fill fork and exec /bin/foo, even if | ||
1232 | * /bin/foo is a symlink to busybox. | ||
1233 | */ | ||
1234 | if (strcmp(newJob->progs[i].argv[0], a->name) == 0) | ||
1235 | #endif | ||
1236 | { | ||
1220 | int argc_l; | 1237 | int argc_l; |
1221 | char** argv=newJob->progs[i].argv; | 1238 | char** argv=newJob->progs[i].argv; |
1222 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 1239 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); |
@@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1217 | /* Check if the command matches any busybox internal commands here */ | 1217 | /* Check if the command matches any busybox internal commands here */ |
1218 | while (a->name != 0) { | 1218 | while (a->name != 0) { |
1219 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | 1219 | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN |
1220 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||
1221 | a->name) == 0) | ||
1222 | #else | ||
1223 | /* Check if the command matches any busybox internal | ||
1224 | * commands ("applets") here. Following discussions from | ||
1225 | * November 2000 on busybox@opensource.lineo.com, don't use | ||
1226 | * get_last_path_component(). This way explicit (with | ||
1227 | * slashes) filenames will never be interpreted as an | ||
1228 | * applet, just like with builtins. This way the user can | ||
1229 | * override an applet with an explicit filename reference. | ||
1230 | * The only downside to this change is that an explicit | ||
1231 | * /bin/foo invocation fill fork and exec /bin/foo, even if | ||
1232 | * /bin/foo is a symlink to busybox. | ||
1233 | */ | ||
1234 | if (strcmp(newJob->progs[i].argv[0], a->name) == 0) | ||
1235 | #endif | ||
1236 | { | ||
1220 | int argc_l; | 1237 | int argc_l; |
1221 | char** argv=newJob->progs[i].argv; | 1238 | char** argv=newJob->progs[i].argv; |
1222 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 1239 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); |
diff --git a/shell/lash.c b/shell/lash.c index 7a8810aef..d6ac1fc17 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1216 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL |
1217 | /* Check if the command matches any busybox internal commands here */ | 1217 | /* Check if the command matches any busybox internal commands here */ |
1218 | while (a->name != 0) { | 1218 | while (a->name != 0) { |
1219 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | 1219 | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN |
1220 | if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||
1221 | a->name) == 0) | ||
1222 | #else | ||
1223 | /* Check if the command matches any busybox internal | ||
1224 | * commands ("applets") here. Following discussions from | ||
1225 | * November 2000 on busybox@opensource.lineo.com, don't use | ||
1226 | * get_last_path_component(). This way explicit (with | ||
1227 | * slashes) filenames will never be interpreted as an | ||
1228 | * applet, just like with builtins. This way the user can | ||
1229 | * override an applet with an explicit filename reference. | ||
1230 | * The only downside to this change is that an explicit | ||
1231 | * /bin/foo invocation fill fork and exec /bin/foo, even if | ||
1232 | * /bin/foo is a symlink to busybox. | ||
1233 | */ | ||
1234 | if (strcmp(newJob->progs[i].argv[0], a->name) == 0) | ||
1235 | #endif | ||
1236 | { | ||
1220 | int argc_l; | 1237 | int argc_l; |
1221 | char** argv=newJob->progs[i].argv; | 1238 | char** argv=newJob->progs[i].argv; |
1222 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 1239 | for(argc_l=0;*argv!=NULL; argv++, argc_l++); |