option-parser: Add support for the '--' options
This toggles parse_options to ignore the rest of the remaining options. Signed-off-by: Nicholas Niro <blowfist@xroutine.net>
This commit is contained in:
parent
7e150101ba
commit
10a455f2ba
@ -167,10 +167,17 @@ parse_options(const struct weston_option *options,
|
||||
int count, int *argc, char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
int ignore_options = 0;
|
||||
|
||||
for (i = 1, j = 1; i < *argc; i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
if (argv[i][0] == '-' && ignore_options == 0) {
|
||||
if (argv[i][1] == '-') {
|
||||
if (strlen(argv[i]) == 2) {
|
||||
/* '--' to ignore the remaining options */
|
||||
i--; /* reinsert the '--' entry */
|
||||
ignore_options = 1;
|
||||
continue;
|
||||
}
|
||||
/* Long option, e.g. --foo or --foo=bar */
|
||||
if (long_option(options, count, argv[i]))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user