Subject: Re: CVS commit: src
To: Hubert Feyrer <>
From: John F. Woods <>
List: tech-userlevel
Date: 01/23/1999 12:04:12
> While we're at getopt-bashing: 
> Matt asked me to parse some options for tetris(6) from some environment
> variable, so he could make some options permanent via the environment. 
> It would be nice if we could add this to some getopt() function somehow to
> parse an environment variable instead of argv[].

getopt(3) knows nothing of the arguments to the main() function.  You
can give it an integer count and character pointer array from any
source you like.  (Of course, the "reinitialize some magic externals"
bit makes doing so a little less convenient than it could be.)

What would be handy is a standard function that takes a delimited
string and returns an array of character pointers; a simple wrapper
around strsep() might be sufficient, although you might want to be
able to quote seperator characters (and there's the rub, no two
consumers of such a "standard" function are likely to want precisely
the same set of features; however, if a standard function were
available which was "good enough" perhaps many authors would be
willing to live within the limits it offered).