Decided to continue using this account for random technical entries (gotta cater to an audience which cares, and all that). The techblogging muse doesn't strike me that often, so still no promises on frequency of updates..
Option-parsing libraries
WvStreams has recently acquired an argument processing class. This really makes life much easier when writing daemons and other tiny network utilities: not having to write tons of boilerplate code for parsing command line options and printing out help/usage messages is a godsend. Unfortunately, the backend library that this class uses (popt) has a number of problems, namely:
- It's not actively maintained in standalone form (you need to download rpm to build it these days).
- It's not buildable using MSVC++ as is.
As an interim solution, I patched the hell out of it to get it compiling under Windows and decided to live with it for the time being (most Linux distributions come with an obsolete version that's good enough for our purposes on that platform).
But really, that's a non-optimal approach over the long term. So I went searching for an alternative. In my travels, I found two widely-distributed libraries which seem to offer comparable functionality: argp (part of glibc) and GOption (of GNOME fame). Both have fatal disadvantages: argp does not exist as a standalone library (hence there is no easy path to distributing it in a form buildable by MSVC++) and GOption is tightly coupled to glib (which is difficult to justify depending on for such a small task).
So I'm pretty much at wits end, except for the slim hope that there might be some viable alternative that I've missed. Does anyone know of a C library for argument processing library which meets the following criteria:
- Actively maintained
- Buildable under both win32 (Microsoft VC++) and Unix
- Free of external dependancies
- Has a sane license (LGPL or BSD)
.. 'cause the alternatives (including a patched copy of popt with WvStreams or writing a new library from scratch) are looking like a whole lot more work than directly reusing something that already exists.
