Re: [ALTERNATE PATCH] Add a simple option parser.
- From
Mike Hommey <mh@glandium.org>
- Date
- Oct 5, 2007, 14:30 UTC
- Message-ID
- <20071005143014.GA18176@glandium.org>
- In-Reply-To
- <20071005142507.GL19879@artemis.corp>
On Fri, Oct 05, 2007 at 04:25:07PM +0200, Pierre Habouzit <madcoder@debian.org> wrote:
Show 10 quoted lines
> The option parser takes argc, argv, an array of struct option > and a usage string. Each of the struct option elements in the array > describes a valid option, its type and a pointer to the location where the > value is written. The entry point is parse_options(), which scans through > the given argv, and matches each option there against the list of valid > options. During the scan, argv is rewritten to only contain the > non-option command line arguments and the number of these is returned. > > Aggregation of single switches is allowed: > -rC0 is the same as -r -C 0 (supposing that -C wants an arg).
I like options aggregation, but I'm not sure aggregating option arguments is a good idea... I can't even think of an application that does it.
Mike