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' */
| 14 | /tmp/opt-example: option requires an argument -- 's' |
| 15 | */ |
| 16 | static int parse_err(void (*errlog)(const char *fmt, ...), |
| 17 | const char *argv0, const char *arg, unsigned len, |
| 18 | const char *problem) |
| 19 | { |
| 20 | errlog("%s: %.*s: %s", argv0, len, arg, problem); |
| 21 | return -1; |
| 22 | } |
| 23 | |
| 24 | static void consume_option(int *argc, char *argv[], unsigned optnum) |
| 25 | { |