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