Good C alternative to Boost.Program_options?

Any good alternative written in C to replace Boost.Program_options? Given that he is able to analyze:

  • Short options like -h
  • Long options like --help --input-file
  • Parsing duplicate keys / options
  • Accepts key-value pairs: -mysql = / usr / lib
  • Analysis of environment variables and XML / INI files is optional.
+4
source share
3 answers

If you agree to the GPL, then you want GNU getopt .

+10
source

POSIX has getopt , glibc adds getopt_long . Both of the links I posted have examples. None of them parse the environment variables of the XML / INI files, but the two do not relate to parsing command-line options. Quick google search results in libraries to be able to do all this.

+4
source

GLib comes with a command line parser that supports your first four requirements, as well as a key file parser that supports the fifth.

+4
source

All Articles