summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-05-16 05:24:03 +0000
committerEric Andersen2001-05-16 05:24:03 +0000
commitbc604a2f417ea290913fedb6807e390e4fc8833e (patch)
treeab4649ded0ebe00fedb48dd4142f1684dc95be8d
parentf72f562b2f118d32d4ca49b6248805936a0cfa66 (diff)
downloadbusybox-bc604a2f417ea290913fedb6807e390e4fc8833e.zip
busybox-bc604a2f417ea290913fedb6807e390e4fc8833e.tar.gz
Move init of a bunch of globals into main so we are at least
a bit more reentrant. -Erik
-rw-r--r--hush.c23
-rw-r--r--shell/hush.c23
2 files changed, 32 insertions, 14 deletions
diff --git a/hush.c b/hush.c
index 5a4966b..c938fb1 100644
--- a/hush.c
+++ b/hush.c
@@ -239,17 +239,17 @@ unsigned int shell_context; /* Used in cmdedit.c to reset the
* context when someone hits ^C */
/* "globals" within this file */
-static char *ifs=NULL;
+static char *ifs;
static char map[256];
-static int fake_mode=0;
-static int interactive=0;
-static struct close_me *close_me_head = NULL;
+static int fake_mode;
+static int interactive;
+static struct close_me *close_me_head;
static const char *cwd;
static struct jobset *job_list;
-static unsigned int last_bg_pid=0;
+static unsigned int last_bg_pid;
static char *PS1;
-static char *PS2 = "> ";
-static char **__shell_local_env = 0;
+static char *PS2;
+static char **__shell_local_env;
#define B_CHUNK (100)
#define B_NOSPAC 1
@@ -2511,7 +2511,16 @@ int shell_main(int argc, char **argv)
int opt;
FILE *input;
struct jobset joblist_end = { NULL, NULL };
+
+ /* (re?) initialize globals */
+ ifs=NULL;
+ fake_mode=0;
+ interactive=0;
+ close_me_head = NULL;
job_list = &joblist_end;
+ last_bg_pid=0;
+ PS2 = "> ";
+ __shell_local_env = 0;
last_return_code=EXIT_SUCCESS;
diff --git a/shell/hush.c b/shell/hush.c
index 5a4966b..c938fb1 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -239,17 +239,17 @@ unsigned int shell_context; /* Used in cmdedit.c to reset the
* context when someone hits ^C */
/* "globals" within this file */
-static char *ifs=NULL;
+static char *ifs;
static char map[256];
-static int fake_mode=0;
-static int interactive=0;
-static struct close_me *close_me_head = NULL;
+static int fake_mode;
+static int interactive;
+static struct close_me *close_me_head;
static const char *cwd;
static struct jobset *job_list;
-static unsigned int last_bg_pid=0;
+static unsigned int last_bg_pid;
static char *PS1;
-static char *PS2 = "> ";
-static char **__shell_local_env = 0;
+static char *PS2;
+static char **__shell_local_env;
#define B_CHUNK (100)
#define B_NOSPAC 1
@@ -2511,7 +2511,16 @@ int shell_main(int argc, char **argv)
int opt;
FILE *input;
struct jobset joblist_end = { NULL, NULL };
+
+ /* (re?) initialize globals */
+ ifs=NULL;
+ fake_mode=0;
+ interactive=0;
+ close_me_head = NULL;
job_list = &joblist_end;
+ last_bg_pid=0;
+ PS2 = "> ";
+ __shell_local_env = 0;
last_return_code=EXIT_SUCCESS;