-/* You can use this directly to build tables, but the macros will ensure
- * consistency and type safety. */
-enum opt_flags {
- OPT_NOARG = 1, /* -f/--foo */
- OPT_HASARG = 2, /* -f arg/--foo=arg/--foo arg */
- OPT_SUBTABLE = 4, /* Actually, longopt points to a subtable... */
- OPT_END = 8, /* End of the table. */
-};
-
-/* Maximum length of arg to show in opt_usage */
-#define OPT_SHOW_LEN 80
-
-struct opt_table {
- const char *names; /* slash-separated names, --longopt or -s */
- enum opt_flags flags;
- char *(*cb)(void *arg); /* OPT_NOARG */
- char *(*cb_arg)(const char *optarg, void *arg); /* OPT_HASARG */
- void (*show)(char buf[OPT_SHOW_LEN], const void *arg);
- void *arg;
- const char *desc;
-};