[project @ 2005-03-31 21:40:15 by wolfgang]
authorwolfgang <unknown>
Thu, 31 Mar 2005 21:40:15 +0000 (21:40 +0000)
committerwolfgang <unknown>
Thu, 31 Mar 2005 21:40:15 +0000 (21:40 +0000)
Fix handling of end-of-options markers (--).
getOpt would correctly return the non-options after the marker, but it
would return errors for things after the marker that looked like options.

MERGE TO STABLE

System/Console/GetOpt.hs

index a3549a3..4098c30 100644 (file)
@@ -164,9 +164,9 @@ getOpt' ordering optDescr (arg:args) = procNextOpt opt ordering
          procNextOpt (NonOpt x)   RequireOrder      = ([],x:rest,us,[])
          procNextOpt (NonOpt x)   Permute           = (os,x:xs,us,es)
          procNextOpt (NonOpt x)   (ReturnInOrder f) = (f x :os, xs,us,es)
-         procNextOpt EndOfOpts    RequireOrder      = ([],rest,us,[])
-         procNextOpt EndOfOpts    Permute           = ([],rest,us,[])
-         procNextOpt EndOfOpts    (ReturnInOrder f) = (map f rest,[],us,[])
+         procNextOpt EndOfOpts    RequireOrder      = ([],rest,[],[])
+         procNextOpt EndOfOpts    Permute           = ([],rest,[],[])
+         procNextOpt EndOfOpts    (ReturnInOrder f) = (map f rest,[],[],[])
          procNextOpt (OptErr e)   _                 = (os,xs,us,e:es)
 
          (opt,rest) = getNext arg args optDescr