4

Any good alternative written in C to replace Boost.Program_options? Given it's able to parse:

  1. Short options like -h
  2. Long options like --help --input-file
  3. Parse repeated keys/options
  4. Accepts key-value pairs: --mysql=/usr/lib
  5. Parsing environmental variables and XML/INI files is optional.
4

3 に答える 3

10

If you are okay with the GPL license, you want GNU getopt.

于 2010-01-19T01:33:06.437 に答える
4

POSIX has getopt, glibc adds getopt_long. Both the links I posted have examples. None of them parses environment variables of XML/INI files, but those two don't really belong with command-line options parsing. A quick google search results in libraries to be able to do those things though.

于 2010-01-19T01:35:48.240 に答える
4

GLib comes with a commandline option parser that supports your first four requirements, and also a key-value file parser that supports the fifth.

于 2010-01-19T01:39:45.700 に答える