diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-16 05:24:03 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-16 05:24:03 +0000 |
commit | bc604a2f417ea290913fedb6807e390e4fc8833e (patch) | |
tree | ab4649ded0ebe00fedb48dd4142f1684dc95be8d | |
parent | f72f562b2f118d32d4ca49b6248805936a0cfa66 (diff) | |
download | busybox-w32-bc604a2f417ea290913fedb6807e390e4fc8833e.tar.gz busybox-w32-bc604a2f417ea290913fedb6807e390e4fc8833e.tar.bz2 busybox-w32-bc604a2f417ea290913fedb6807e390e4fc8833e.zip |
Move init of a bunch of globals into main so we are at least
a bit more reentrant.
-Erik
-rw-r--r-- | hush.c | 23 | ||||
-rw-r--r-- | shell/hush.c | 23 |
2 files changed, 32 insertions, 14 deletions
@@ -239,17 +239,17 @@ unsigned int shell_context; /* Used in cmdedit.c to reset the | |||
239 | * context when someone hits ^C */ | 239 | * context when someone hits ^C */ |
240 | 240 | ||
241 | /* "globals" within this file */ | 241 | /* "globals" within this file */ |
242 | static char *ifs=NULL; | 242 | static char *ifs; |
243 | static char map[256]; | 243 | static char map[256]; |
244 | static int fake_mode=0; | 244 | static int fake_mode; |
245 | static int interactive=0; | 245 | static int interactive; |
246 | static struct close_me *close_me_head = NULL; | 246 | static struct close_me *close_me_head; |
247 | static const char *cwd; | 247 | static const char *cwd; |
248 | static struct jobset *job_list; | 248 | static struct jobset *job_list; |
249 | static unsigned int last_bg_pid=0; | 249 | static unsigned int last_bg_pid; |
250 | static char *PS1; | 250 | static char *PS1; |
251 | static char *PS2 = "> "; | 251 | static char *PS2; |
252 | static char **__shell_local_env = 0; | 252 | static char **__shell_local_env; |
253 | 253 | ||
254 | #define B_CHUNK (100) | 254 | #define B_CHUNK (100) |
255 | #define B_NOSPAC 1 | 255 | #define B_NOSPAC 1 |
@@ -2511,7 +2511,16 @@ int shell_main(int argc, char **argv) | |||
2511 | int opt; | 2511 | int opt; |
2512 | FILE *input; | 2512 | FILE *input; |
2513 | struct jobset joblist_end = { NULL, NULL }; | 2513 | struct jobset joblist_end = { NULL, NULL }; |
2514 | |||
2515 | /* (re?) initialize globals */ | ||
2516 | ifs=NULL; | ||
2517 | fake_mode=0; | ||
2518 | interactive=0; | ||
2519 | close_me_head = NULL; | ||
2514 | job_list = &joblist_end; | 2520 | job_list = &joblist_end; |
2521 | last_bg_pid=0; | ||
2522 | PS2 = "> "; | ||
2523 | __shell_local_env = 0; | ||
2515 | 2524 | ||
2516 | last_return_code=EXIT_SUCCESS; | 2525 | last_return_code=EXIT_SUCCESS; |
2517 | 2526 | ||
diff --git a/shell/hush.c b/shell/hush.c index 5a4966b07..c938fb1e3 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -239,17 +239,17 @@ unsigned int shell_context; /* Used in cmdedit.c to reset the | |||
239 | * context when someone hits ^C */ | 239 | * context when someone hits ^C */ |
240 | 240 | ||
241 | /* "globals" within this file */ | 241 | /* "globals" within this file */ |
242 | static char *ifs=NULL; | 242 | static char *ifs; |
243 | static char map[256]; | 243 | static char map[256]; |
244 | static int fake_mode=0; | 244 | static int fake_mode; |
245 | static int interactive=0; | 245 | static int interactive; |
246 | static struct close_me *close_me_head = NULL; | 246 | static struct close_me *close_me_head; |
247 | static const char *cwd; | 247 | static const char *cwd; |
248 | static struct jobset *job_list; | 248 | static struct jobset *job_list; |
249 | static unsigned int last_bg_pid=0; | 249 | static unsigned int last_bg_pid; |
250 | static char *PS1; | 250 | static char *PS1; |
251 | static char *PS2 = "> "; | 251 | static char *PS2; |
252 | static char **__shell_local_env = 0; | 252 | static char **__shell_local_env; |
253 | 253 | ||
254 | #define B_CHUNK (100) | 254 | #define B_CHUNK (100) |
255 | #define B_NOSPAC 1 | 255 | #define B_NOSPAC 1 |
@@ -2511,7 +2511,16 @@ int shell_main(int argc, char **argv) | |||
2511 | int opt; | 2511 | int opt; |
2512 | FILE *input; | 2512 | FILE *input; |
2513 | struct jobset joblist_end = { NULL, NULL }; | 2513 | struct jobset joblist_end = { NULL, NULL }; |
2514 | |||
2515 | /* (re?) initialize globals */ | ||
2516 | ifs=NULL; | ||
2517 | fake_mode=0; | ||
2518 | interactive=0; | ||
2519 | close_me_head = NULL; | ||
2514 | job_list = &joblist_end; | 2520 | job_list = &joblist_end; |
2521 | last_bg_pid=0; | ||
2522 | PS2 = "> "; | ||
2523 | __shell_local_env = 0; | ||
2515 | 2524 | ||
2516 | last_return_code=EXIT_SUCCESS; | 2525 | last_return_code=EXIT_SUCCESS; |
2517 | 2526 | ||