Index: GetOpt.hs
===================================================================
RCS file: /cvs/fptools/libraries/base/System/Console/GetOpt.hs,v
retrieving revision 1.11
diff -u -r1.11 GetOpt.hs
--- GetOpt.hs	11 Mar 2003 18:41:43 -0000	1.11
+++ GetOpt.hs	25 Mar 2004 16:25:31 -0000
@@ -98,19 +98,22 @@
           -> [OptDescr a]              -- option descriptors
           -> String                    -- nicely formatted decription of options
 usageInfo header optDescr = unlines (header:table)
-   where (ss,ls,ds)     = (unzip3 . map fmtOpt) optDescr
+   where (ss,ls,ds)     = (unzip3 . concatMap fmtOpt) optDescr
          table          = zipWith3 paste (sameLen ss) (sameLen ls) ds
          paste x y z    = "  " ++ x ++ "  " ++ y ++ "  " ++ z
          sameLen xs     = flushLeft ((maximum . map length) xs) xs
          flushLeft n xs = [ take n (x ++ repeat ' ') | x <- xs ]
 
-fmtOpt :: OptDescr a -> (String,String,String)
-fmtOpt (Option sos los ad descr) = (sepBy ',' (map (fmtShort ad) sos),
-                                    sepBy ',' (map (fmtLong  ad) los),
-                                    descr)
+fmtOpt :: OptDescr a -> [(String,String,String)]
+fmtOpt (Option sos los ad descr) =
+   case lines descr of
+     []     -> [(sosFmt,losFmt,"")]
+     (d:ds) ->  (sosFmt,losFmt,d) : [ ("","",d') | d' <- ds ]
    where sepBy _  []     = ""
          sepBy _  [x]    = x
          sepBy ch (x:xs) = x ++ ch:' ':sepBy ch xs
+         sosFmt = sepBy ',' (map (fmtShort ad) sos)
+         losFmt = sepBy ',' (map (fmtLong  ad) los)
 
 fmtShort :: ArgDescr a -> Char -> String
 fmtShort (NoArg  _   ) so = "-" ++ [so]
