Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src
I have a getopt replacement that is almost completely backward
compatible, but also parses full or partial string arguments, numeric
arguments, and "+" options (which are also parsed as "--" options).
One missing feature is the ability to set the global "opterr". It
currently behaves as if this is set to 0. Support could be easily
added but I have not had the desire to do so.
Feel free to check out <ftp://ftp.codegen.com/pub/getoptx/getoptx.tgz>
and use. It's complete with a man-page and self-test.
The main arg-parsing loop looks something like this:
...
while ((c = getoptx(argc, argv,
/* minus options */
"(#)ab:c(debug)(debugl/evel:1001):(?:1002)",
/* plus options (may be NULL) */
"(foo)(bar):(FOO:f)(BAR:b):(#)xy:z"
)) != EOF)
{
case 'a': ...
case '1001': ...
...
The code is free for any use as long as all the copyrights are
maintained in the sources. It is *not* copylefted. It's also very
small and simple.
-- Parag Patel
Home |
Main Index |
Thread Index |
Old Index