summaryrefslogtreecommitdiff
path: root/shell/lash.c
diff options
context:
space:
mode:
authorMike Frysinger2005-03-04 01:33:17 +0000
committerMike Frysinger2005-03-04 01:33:17 +0000
commitdcc40b7ecc582e5c613276f0a92b942bead8ccd6 (patch)
treea78b573197933a69b70adbe6225d9feffae96316 /shell/lash.c
parent9b9e5479e84a49df631c92192d76770ea016bb3e (diff)
downloadbusybox-dcc40b7ecc582e5c613276f0a92b942bead8ccd6.zip
busybox-dcc40b7ecc582e5c613276f0a92b942bead8ccd6.tar.gz
Shaun Jackman writes: Newlib uses both __getopt_initialized and optind to track initialization of getopt()
Diffstat (limited to 'shell/lash.c')
-rw-r--r--shell/lash.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/shell/lash.c b/shell/lash.c
index f454e69..c4655ac 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1277,11 +1277,17 @@ static int pseudo_exec(struct child_prog *child)
name = child->argv[0];
{
- char** argv_l=child->argv;
- int argc_l;
- for(argc_l=0;*argv_l!=NULL; argv_l++, argc_l++);
- optind = 1;
- run_applet_by_name(name, argc_l, child->argv);
+ char** argv_l=child->argv;
+ int argc_l;
+#ifdef _NEWLIB_VERSION
+ /* newlib uses __getopt_initialized for getopt() in
+ * addition to optind, see newlib/libc/sys/linux/getopt.c
+ */
+ extern int __getopt_initialized = 0;
+#endif
+ for(argc_l=0;*argv_l!=NULL; argv_l++, argc_l++);
+ optind = 1;
+ run_applet_by_name(name, argc_l, child->argv);
}
#endif