Subject: Re: CVS commit: src
To: Hubert Feyrer <email@example.com>
From: Luke Mewburn <firstname.lastname@example.org>
Date: 01/24/1999 10:19:00
Hubert Feyrer writes:
> On Sat, 23 Jan 1999, Charles M. Hannum wrote:
> > Actually, there have more or less been plans to add long options to
> > everything eventually. I'm not sure I want to waste any time arguing
> > about whether that's a good idea or not; it really comes down to a
> > matter of religion. My religion says that if a lot of people install
> > GNU fileutils just to get long options (and they do), then maybe we
> > should do something about that.
> 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.
> LS=-la ; export LS ; ls => behave as if "ls -la" was invoked
years ago (1992 or 1993?) i contributed the framework of such a feature
to gzip 1.0.6. i've since pulled it back into one of my own products.
void add_envopt(int argc, char ***argv, char *envvar);
what it does is parses the environment var named in envvar and prepends
the expanded tokens to argv/argc, so that the standard getopt is then run
it gets the prepended options first, so the user has a chance to override
on the command line.
unfortunately, this code is GPL (this is before i decided i liked the
BSD license better) and can't be used as it stands in libc/libutil.
it's a fairly trivial function, and in any case, if i asked Jean Loup
Gailly if he a) remembers me providing the original code (which he
then added features to), and b) minds me putting it under a BSD license,
then we could use it.