summaryrefslogtreecommitdiff
path: root/posix/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/getopt.c')
-rw-r--r--posix/getopt.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/posix/getopt.c b/posix/getopt.c
index 7fef53a0b3..85647e2d36 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
@@ -387,7 +387,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
optarg = NULL;
if (optind == 0)
- optstring = _getopt_initialize (optstring);
+ {
+ optstring = _getopt_initialize (optstring);
+ optind = 1; /* Don't scan ARGV[0], the program name. */
+ }
if (nextchar == NULL || *nextchar == '\0')
{