diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-10-24 05:00:29 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-10-24 05:00:29 +0000 |
commit | 1e2799601614452a40df7862e6ca180ecb08c04d (patch) | |
tree | 153a573095afac8d8d0ea857759ecabd77fb28b7 /shell/lash.c | |
parent | 47f91d1f7fc06cf27e2a6c3c2ada99226ba50cb9 (diff) | |
download | busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.gz busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.bz2 busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.zip |
Major rework of the directory structure and the entire build system.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@3561 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell/lash.c')
-rw-r--r-- | shell/lash.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/shell/lash.c b/shell/lash.c index ffdec8781..004d9495a 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -2,8 +2,8 @@ | |||
2 | /* | 2 | /* |
3 | * lash -- the BusyBox Lame-Ass SHell | 3 | * lash -- the BusyBox Lame-Ass SHell |
4 | * | 4 | * |
5 | * Copyright (C) 1999,2000,2001 by Lineo, inc. | 5 | * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen |
6 | * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> | 6 | * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org> |
7 | * | 7 | * |
8 | * Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is | 8 | * Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is |
9 | * under the following liberal license: "We have placed this source code in the | 9 | * under the following liberal license: "We have placed this source code in the |
@@ -25,8 +25,10 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* This shell's parsing engine is officially at a dead-end. | 28 | /* This shell's parsing engine is officially at a dead-end. Future |
29 | * Future work shell work should be done using hush.c | 29 | * work shell work should be done using hush, msh, or ash. This is |
30 | * still a very useful, small shell -- it just don't need any more | ||
31 | * features beyond what it already has... | ||
30 | */ | 32 | */ |
31 | 33 | ||
32 | //For debugging/development on the shell only... | 34 | //For debugging/development on the shell only... |
@@ -48,7 +50,7 @@ | |||
48 | #include "busybox.h" | 50 | #include "busybox.h" |
49 | #include "cmdedit.h" | 51 | #include "cmdedit.h" |
50 | 52 | ||
51 | #ifdef BB_LOCALE_SUPPORT | 53 | #ifdef CONFIG_LOCALE_SUPPORT |
52 | #include <locale.h> | 54 | #include <locale.h> |
53 | #endif | 55 | #endif |
54 | 56 | ||
@@ -390,12 +392,12 @@ static int builtin_export(struct child_prog *child) | |||
390 | res = putenv(v); | 392 | res = putenv(v); |
391 | if (res) | 393 | if (res) |
392 | fprintf(stderr, "export: %m\n"); | 394 | fprintf(stderr, "export: %m\n"); |
393 | #ifdef BB_FEATURE_SH_FANCY_PROMPT | 395 | #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT |
394 | if (strncmp(v, "PS1=", 4)==0) | 396 | if (strncmp(v, "PS1=", 4)==0) |
395 | PS1 = getenv("PS1"); | 397 | PS1 = getenv("PS1"); |
396 | #endif | 398 | #endif |
397 | 399 | ||
398 | #ifdef BB_LOCALE_SUPPORT | 400 | #ifdef CONFIG_LOCALE_SUPPORT |
399 | if(strncmp(v, "LC_ALL=", 7)==0) | 401 | if(strncmp(v, "LC_ALL=", 7)==0) |
400 | setlocale(LC_ALL, getenv("LC_ALL")); | 402 | setlocale(LC_ALL, getenv("LC_ALL")); |
401 | if(strncmp(v, "LC_CTYPE=", 9)==0) | 403 | if(strncmp(v, "LC_CTYPE=", 9)==0) |
@@ -661,7 +663,7 @@ static void restore_redirects(int squirrel[]) | |||
661 | 663 | ||
662 | static inline void cmdedit_set_initial_prompt(void) | 664 | static inline void cmdedit_set_initial_prompt(void) |
663 | { | 665 | { |
664 | #ifndef BB_FEATURE_SH_FANCY_PROMPT | 666 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT |
665 | PS1 = NULL; | 667 | PS1 = NULL; |
666 | #else | 668 | #else |
667 | PS1 = getenv("PS1"); | 669 | PS1 = getenv("PS1"); |
@@ -672,7 +674,7 @@ static inline void cmdedit_set_initial_prompt(void) | |||
672 | 674 | ||
673 | static inline void setup_prompt_string(char **prompt_str) | 675 | static inline void setup_prompt_string(char **prompt_str) |
674 | { | 676 | { |
675 | #ifndef BB_FEATURE_SH_FANCY_PROMPT | 677 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT |
676 | /* Set up the prompt */ | 678 | /* Set up the prompt */ |
677 | if (shell_context == 0) { | 679 | if (shell_context == 0) { |
678 | if (PS1) | 680 | if (PS1) |
@@ -706,7 +708,7 @@ static int get_command(FILE * source, char *command) | |||
706 | if (source == stdin) { | 708 | if (source == stdin) { |
707 | setup_prompt_string(&prompt_str); | 709 | setup_prompt_string(&prompt_str); |
708 | 710 | ||
709 | #ifdef BB_FEATURE_COMMAND_EDITING | 711 | #ifdef CONFIG_FEATURE_COMMAND_EDITING |
710 | /* | 712 | /* |
711 | ** enable command line editing only while a command line | 713 | ** enable command line editing only while a command line |
712 | ** is actually being read; otherwise, we'll end up bequeathing | 714 | ** is actually being read; otherwise, we'll end up bequeathing |
@@ -1201,7 +1203,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) | |||
1201 | static int pseudo_exec(struct child_prog *child) | 1203 | static int pseudo_exec(struct child_prog *child) |
1202 | { | 1204 | { |
1203 | struct built_in_command *x; | 1205 | struct built_in_command *x; |
1204 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1206 | #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL |
1205 | char *name; | 1207 | char *name; |
1206 | #endif | 1208 | #endif |
1207 | 1209 | ||
@@ -1223,7 +1225,7 @@ static int pseudo_exec(struct child_prog *child) | |||
1223 | exit (x->function(child)); | 1225 | exit (x->function(child)); |
1224 | } | 1226 | } |
1225 | } | 1227 | } |
1226 | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | 1228 | #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL |
1227 | /* Check if the command matches any busybox internal | 1229 | /* Check if the command matches any busybox internal |
1228 | * commands ("applets") here. Following discussions from | 1230 | * commands ("applets") here. Following discussions from |
1229 | * November 2000 on busybox@opensource.lineo.com, don't use | 1231 | * November 2000 on busybox@opensource.lineo.com, don't use |
@@ -1237,8 +1239,8 @@ static int pseudo_exec(struct child_prog *child) | |||
1237 | */ | 1239 | */ |
1238 | name = child->argv[0]; | 1240 | name = child->argv[0]; |
1239 | 1241 | ||
1240 | #ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN | 1242 | #ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN |
1241 | /* If you enable BB_FEATURE_SH_APPLETS_ALWAYS_WIN, then | 1243 | /* If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then |
1242 | * if you run /bin/cat, it will use BusyBox cat even if | 1244 | * if you run /bin/cat, it will use BusyBox cat even if |
1243 | * /bin/cat exists on the filesystem and is _not_ busybox. | 1245 | * /bin/cat exists on the filesystem and is _not_ busybox. |
1244 | * Some systems want this, others do not. Choose wisely. :-) | 1246 | * Some systems want this, others do not. Choose wisely. :-) |
@@ -1504,7 +1506,7 @@ static int busy_loop(FILE * input) | |||
1504 | } | 1506 | } |
1505 | 1507 | ||
1506 | 1508 | ||
1507 | #ifdef BB_FEATURE_CLEAN_UP | 1509 | #ifdef CONFIG_FEATURE_CLEAN_UP |
1508 | void free_memory(void) | 1510 | void free_memory(void) |
1509 | { | 1511 | { |
1510 | if (cwd && cwd!=unknown) { | 1512 | if (cwd && cwd!=unknown) { |
@@ -1611,7 +1613,7 @@ int lash_main(int argc_l, char **argv_l) | |||
1611 | if (interactive==TRUE) { | 1613 | if (interactive==TRUE) { |
1612 | //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); | 1614 | //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); |
1613 | /* Looks like they want an interactive shell */ | 1615 | /* Looks like they want an interactive shell */ |
1614 | #ifndef BB_FEATURE_SH_EXTRA_QUIET | 1616 | #ifndef CONFIG_FEATURE_SH_EXTRA_QUIET |
1615 | printf( "\n\n" BB_BANNER " Built-in shell (lash)\n"); | 1617 | printf( "\n\n" BB_BANNER " Built-in shell (lash)\n"); |
1616 | printf( "Enter 'help' for a list of built-in commands.\n\n"); | 1618 | printf( "Enter 'help' for a list of built-in commands.\n\n"); |
1617 | #endif | 1619 | #endif |
@@ -1626,11 +1628,11 @@ int lash_main(int argc_l, char **argv_l) | |||
1626 | if (!cwd) | 1628 | if (!cwd) |
1627 | cwd = unknown; | 1629 | cwd = unknown; |
1628 | 1630 | ||
1629 | #ifdef BB_FEATURE_CLEAN_UP | 1631 | #ifdef CONFIG_FEATURE_CLEAN_UP |
1630 | atexit(free_memory); | 1632 | atexit(free_memory); |
1631 | #endif | 1633 | #endif |
1632 | 1634 | ||
1633 | #ifdef BB_FEATURE_COMMAND_EDITING | 1635 | #ifdef CONFIG_FEATURE_COMMAND_EDITING |
1634 | cmdedit_set_initial_prompt(); | 1636 | cmdedit_set_initial_prompt(); |
1635 | #else | 1637 | #else |
1636 | PS1 = NULL; | 1638 | PS1 = NULL; |