diff options
Diffstat (limited to 'tools/lib/subcmd/parse-options.c')
| -rw-r--r-- | tools/lib/subcmd/parse-options.c | 18 | 
1 files changed, 9 insertions, 9 deletions
| diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index 359bfa77f39c..2bd6fd0c1d40 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -368,7 +368,7 @@ retry:  			return 0;  		}  		if (!rest) { -			if (!prefixcmp(options->long_name, "no-")) { +			if (strstarts(options->long_name, "no-")) {  				/*  				 * The long name itself starts with "no-", so  				 * accept the option without "no-" so that users @@ -381,7 +381,7 @@ retry:  					goto match;  				}  				/* Abbreviated case */ -				if (!prefixcmp(options->long_name + 3, arg)) { +				if (strstarts(options->long_name + 3, arg)) {  					flags |= OPT_UNSET;  					goto is_abbreviated;  				} @@ -406,7 +406,7 @@ is_abbreviated:  				continue;  			}  			/* negated and abbreviated very much? */ -			if (!prefixcmp("no-", arg)) { +			if (strstarts("no-", arg)) {  				flags |= OPT_UNSET;  				goto is_abbreviated;  			} @@ -416,7 +416,7 @@ is_abbreviated:  			flags |= OPT_UNSET;  			rest = skip_prefix(arg + 3, options->long_name);  			/* abbreviated and negated? */ -			if (!rest && !prefixcmp(options->long_name, arg + 3)) +			if (!rest && strstarts(options->long_name, arg + 3))  				goto is_abbreviated;  			if (!rest)  				continue; @@ -456,7 +456,7 @@ static void check_typos(const char *arg, const struct option *options)  	if (strlen(arg) < 3)  		return; -	if (!prefixcmp(arg, "no-")) { +	if (strstarts(arg, "no-")) {  		fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg);  		exit(129);  	} @@ -464,7 +464,7 @@ static void check_typos(const char *arg, const struct option *options)  	for (; options->type != OPTION_END; options++) {  		if (!options->long_name)  			continue; -		if (!prefixcmp(options->long_name, arg)) { +		if (strstarts(options->long_name, arg)) {  			fprintf(stderr, " Error: did you mean `--%s` (with two dashes ?)", arg);  			exit(129);  		} @@ -933,10 +933,10 @@ opt:  		if (opts->long_name == NULL)  			continue; -		if (!prefixcmp(opts->long_name, optstr)) +		if (strstarts(opts->long_name, optstr))  			print_option_help(opts, 0); -		if (!prefixcmp("no-", optstr) && -		    !prefixcmp(opts->long_name, optstr + 3)) +		if (strstarts("no-", optstr) && +		    strstarts(opts->long_name, optstr + 3))  			print_option_help(opts, 0);  	} |