开发者

A good C alternative for Boost.Program_options?

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 开发者_StackOverflowfiles is optional.


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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜