more wgetopt_long() normalization

This commit is contained in:
Kurtis Rader
2017-06-29 21:49:57 -07:00
parent bf2a9f3835
commit dd191a9d4b
15 changed files with 83 additions and 25 deletions

View File

@@ -210,7 +210,7 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv)
return STATUS_CMD_ERROR;
}
static const wchar_t *short_options = L"abijpctwforhI:CLSsP";
static const wchar_t *short_options = L":abijpctwforhI:CLSsP";
static const struct woption long_options[] = {{L"append", no_argument, NULL, 'a'},
{L"insert", no_argument, NULL, 'i'},
{L"replace", no_argument, NULL, 'r'},
@@ -303,6 +303,10 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv)
builtin_print_help(parser, streams, cmd, streams.out);
return STATUS_CMD_OK;
}
case ':': {
streams.err.append_format(BUILTIN_ERR_MISSING, cmd, argv[w.woptind - 1]);
return STATUS_INVALID_ARGS;
}
case L'?': {
builtin_unknown_option(parser, streams, cmd, argv[w.woptind - 1]);
return STATUS_INVALID_ARGS;