OptFetch is a lightweight library for parsing options from the command-line.
It should be considered complete at this point; if no modifications have been
for a long time, it is because there are no more modifications to make. Any
bugs or obvious deficiencies will be fixed; aside from that, I consider it done.
OVERVIEW
Watch:
bool debug;
char *name;
float boat;
struct opttype opts[] = {
{"debug", 'd', OPTTYPE_BOOL, &debug},
{"name", 'n', OPTTYPE_STRING, &name},
{"boat", 'b', OPTTYPE_FLOAT, &boat},
{0}
};
fetchopts(&argc, &argv, opts);
Now wasn't that easy?
C89. No allocations or VLAs. See example.c for further minutiae, and
optfetch.h for the full list of argument types.
MOTIVATION
Right now, there are quite a few argument-parsing libraries. Unfortunately,
none of them are very useful to their consumers. This is because they are too
complicated and flexible. This makes the library user do entirely too much work
just to get a couple of toggleable flags; yet, at the same time, it doesn't
offer very much to applications with complicated argument-parsing needs. The
latter group would be best-served by a home-rolled parser. This project
provides a simple solution for the former group that doesn't get in the way.