Updated from ../gpl2lgpl.sed /home/gd/gnu/lib/getopt.c
authorMiles Bader <miles@gnu.org>
Tue, 13 Feb 1996 18:28:59 +0000 (18:28 +0000)
committerMiles Bader <miles@gnu.org>
Tue, 13 Feb 1996 18:28:59 +0000 (18:28 +0000)
posix/getopt.c

index 4e11744..24da4d3 100644 (file)
@@ -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, 95
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
        Free Software Foundation, Inc.
 
 This file is part of the GNU C Library.  Its master source is NOT part of
@@ -435,6 +435,13 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
     {
       /* Advance to the next ARGV-element.  */
 
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+        moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+       last_nonopt = optind;
+      if (first_nonopt > optind)
+       first_nonopt = optind;
+
       if (ordering == PERMUTE)
        {
          /* If we have just processed some options following some non-options,