diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-12-03 13:42:17 +0300 | 
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-12-03 13:42:17 +0300 | 
| commit | 5f675231e456cb599b283f8361f01cf34b0617df (patch) | |
| tree | afb2bdfd6fdbb18336146f41ba7659120a5ff9d2 /tools/lib/subcmd/parse-options.c | |
| parent | 3e184501083c38fa091f640acb13af17a21fd228 (diff) | |
| parent | 2595646791c319cadfdbf271563aac97d0843dc7 (diff) | |
| download | linux-5f675231e456cb599b283f8361f01cf34b0617df.tar.xz | |
Merge tag 'v4.20-rc5' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/lib/subcmd/parse-options.c')
| -rw-r--r-- | tools/lib/subcmd/parse-options.c | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index cb7154eccbdc..dbb9efbf718a 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/tools/lib/subcmd/parse-options.c @@ -116,6 +116,7 @@ static int get_value(struct parse_opt_ctx_t *p,  		case OPTION_INTEGER:  		case OPTION_UINTEGER:  		case OPTION_LONG: +		case OPTION_ULONG:  		case OPTION_U64:  		default:  			break; @@ -166,6 +167,7 @@ static int get_value(struct parse_opt_ctx_t *p,  		case OPTION_INTEGER:  		case OPTION_UINTEGER:  		case OPTION_LONG: +		case OPTION_ULONG:  		case OPTION_U64:  		default:  			break; @@ -295,6 +297,22 @@ static int get_value(struct parse_opt_ctx_t *p,  			return opterror(opt, "expects a numerical value", flags);  		return 0; +	case OPTION_ULONG: +		if (unset) { +			*(unsigned long *)opt->value = 0; +			return 0; +		} +		if (opt->flags & PARSE_OPT_OPTARG && !p->opt) { +			*(unsigned long *)opt->value = opt->defval; +			return 0; +		} +		if (get_arg(p, opt, flags, &arg)) +			return -1; +		*(unsigned long *)opt->value = strtoul(arg, (char **)&s, 10); +		if (*s) +			return opterror(opt, "expects a numerical value", flags); +		return 0; +  	case OPTION_U64:  		if (unset) {  			*(u64 *)opt->value = 0; @@ -703,6 +721,7 @@ static void print_option_help(const struct option *opts, int full)  	case OPTION_ARGUMENT:  		break;  	case OPTION_LONG: +	case OPTION_ULONG:  	case OPTION_U64:  	case OPTION_INTEGER:  	case OPTION_UINTEGER:  | 
