aboutsummaryrefslogtreecommitdiff
path: root/util-linux/getopt.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-20 07:52:33 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-20 07:52:33 +0000
commitd1660cb9ad3adb4b99c098de88f79cbeb74c3a5d (patch)
treecddc476b03fc1eb2eb95f16399b55348b306885e /util-linux/getopt.c
parent802a7be54ffcf6e45808d72e2562456bba564028 (diff)
downloadbusybox-d1660cb9ad3adb4b99c098de88f79cbeb74c3a5d.tar.gz
ash: fix a bug in standalone mode (corrupted getopt() state)
Diffstat (limited to 'util-linux/getopt.c')
-rw-r--r--util-linux/getopt.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 402630385..8b5e46c7b 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -142,7 +142,8 @@ static const char *normalize(const char *arg)
* Other settings are found in global variables.
*/
#if !ENABLE_GETOPT_LONG
-#define generate_output(argv,argc,optstr,longopts) generate_output(argv,argc,optstr)
+#define generate_output(argv,argc,optstr,longopts) \
+ generate_output(argv,argc,optstr)
#endif
static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts)
{
@@ -156,14 +157,6 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru
if (quiet_errors) /* No error reporting from getopt(3) */
opterr = 0;
- /* Reset getopt(3) (see libbb/getopt32.c for long rant) */
-#ifdef __GLIBC__
- optind = 0;
-#else /* BSD style */
- optind = 1;
- /* optreset = 1; */
-#endif
-
while (1) {
opt =
#if ENABLE_GETOPT_LONG