-/* glibc does this as:
-/tmp/opt-example: invalid option -- 'x'
-/tmp/opt-example: unrecognized option '--long'
-/tmp/opt-example: option '--someflag' doesn't allow an argument
-/tmp/opt-example: option '--s' is ambiguous
-/tmp/opt-example: option requires an argument -- 's'
-*/
-static void parse_fail(void (*errlog)(const char *fmt, ...),
- char shortopt, const char *longopt, const char *problem)
-{
- if (shortopt)
- errlog("%s: -%c: %s", opt_argv0, shortopt, problem);
- else
- errlog("%s: --%.*s: %s", opt_argv0,
- strcspn(longopt, "/"), longopt, problem);
-}
-
-/* Parse your arguments. */
-bool opt_parse(int *argc, char *argv[], void (*errlog)(const char *fmt, ...))
-{
- char *optstring = make_optstring();
- struct option *options = make_options();
- int ret, longidx = 0;
- struct opt_table *e;
-
- /* We will do our own error reporting. */
- opterr = 0;