Re: [Help] Usable command options parser for C
T o n g <mlist4suntong@yahoo.com> writes:
> I know that the best command options parser is the GNU getopt(3)
> routines. I know that the GNU has a wrapper to generate C code around the
> GNU getopt(3) routines -- the http://www.gnu.org/software/gengetopt/.
> However, that wrapper, gengetopt, is dated and lacks of maintenance now.
> It is causing segmentation faults on newer systems --
> https://savannah.gnu.org/bugs/?40370
> So I'm wondering what my other options are. If I need to build a tool in
> C that needs command options parsing, which tool/lib will make my life a
> bit easier? I don't need fancy functionalities. Nice and simple would be
> good enough for me and more preferable.
You could try AutoOpts:
https://www.gnu.org/software/autogen/autoopts.html
although "nice and simple" isn't how I'd describe it. But it's certainly
actively maintained.
I always just write this stuff by hand, but I also mostly don't support
long options. I keep meaning to find a more portable solution to that for
C programs than GNU getopt_long(3).
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: