Re: [PATCH 3/5 v4] diff: parse detached options --stat-width n, --stat-name-width n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthieu Moy <Matthieu.Moy@xxxxxxx> writes:

> Part of a campaign for unstuck forms of options.
>
>  	switch (*arg) {
>  	case '-':
> -		if (!prefixcmp(arg, "-width="))
> -			width = strtoul(arg + 7, &end, 10);
> -		else if (!prefixcmp(arg, "-name-width="))
> -			name_width = strtoul(arg + 12, &end, 10);
> +		if (!prefixcmp(arg, "-width")) {
> +			arg += strlen("-width");
> +			if (*arg == '=')
> +				width = strtoul(arg + 1, &end, 10);
> +			else if (!*arg && !av[1])
> +				die("Option '--stat-width' requires a value");
> +			else if (!*arg) {
> +				width = strtoul(av[1], &end, 10);
> +				argcount = 2;
> +			}
> +		} else if (!prefixcmp(arg, "-name-width")) {
> +			arg += strlen("-name-width");
> +			if (*arg == '=')
> +				name_width = strtoul(arg + 1, &end, 10);
> +			else if (!*arg && !av[1])
> +				die("Option '--stat-name-width' requires a value");
> +			else if (!*arg) {
> +				name_width = strtoul(av[1], &end, 10);
> +				argcount = 2;
> +			}
> +		}
>  		break;
>  	case '=':
>  		width = strtoul(arg+1, &end, 10);

This will accept "--stat-width=40", "--stat-width 40", and "--stat=40,20"
but not "--stat 40,20" --- am I reading the patch correctly?

Not a complaint but trying to double-check.  I think it is Ok not to try
guessing wrong (the user may be interested in a path 40,20, for example).

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]