GetOpt formatting improvements

Brandon S.Allbery KF8NH allbery at
Wed Jul 2 10:36:54 EDT 2008

On 2008 Jul 2, at 6:40, Isaac Dupree wrote:

> Brandon S. Allbery KF8NH wrote:
>> On of the points of getopt is that -fFLAGS and -f FLAGS both work  
>> without any extra code.  Standard getopt doesn't do optional  
>> arguments at all; GNU getopt handles -vn, -v n, and -v -- or -v -x  
>> (for random options -v, -x, the former taking an optional argument;  
>> the latter two cases are recognized as argument omitted).
> and we say cabal uses a getopt equivalent to this?  Yet it doesn't  
> work that way for me, in

We've apparently reinvented the situation that led to AT&T freeing the  
original getopt() code, I see :)  People who roll their own getopt()  
clone usually miss the corner cases.

> cabal-install 0.5.1:
> > cabal fetch -v 3 random
> cabal: Failed to parse package dependency: "3"
> > cabal fetch -v3 random
> Reading installed packages...
> ("/usr/bin/ghc-pkg",["list"])
> Reading available packages...
> (which, incidentally, I was doing to try to find out why 'cabal  
> fetch' doesn't seem to do anything.  And failed miserably.  No  
> messages, no new directories in ~/.cabal/packages/ 
> or in ./  ... Oh wait, fetching uvector works.   
> Maybe it's because GHC comes with random- so cabal  
> erroneously thinks it already has the source code that I want to  
> look at, i.e. "for later installation *or study*" as `cabal --help`  
> says?)
> -Isaac

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at
system administrator [openafs,heimdal,too many hats] allbery at
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Libraries mailing list