[BusyBox-cvs] svn commit: trunk/busybox/shell

vapier at busybox.net vapier at busybox.net
Fri Mar 4 01:33:18 UTC 2005


Author: vapier
Date: 2005-03-03 18:33:17 -0700 (Thu, 03 Mar 2005)
New Revision: 9972

Log:
Shaun Jackman writes: Newlib uses both __getopt_initialized and optind to track initialization of getopt()

Modified:
   trunk/busybox/shell/lash.c


Changeset:
Modified: trunk/busybox/shell/lash.c
===================================================================
--- trunk/busybox/shell/lash.c	2005-03-04 01:27:18 UTC (rev 9971)
+++ trunk/busybox/shell/lash.c	2005-03-04 01:33:17 UTC (rev 9972)
@@ -1277,11 +1277,17 @@
 	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
 




More information about the busybox-cvs mailing list