Re: [PATCH] bash-completion: fix getting strategy list

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

 



Johannes Sixt schrieb:
> Nguyen Thai Ngoc Duy schrieb:
>> +	if (argc == 2 && !strcmp(argv[1], "--show-strategies")) {
>> +		for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
>> +			printf("%s\n", all_strategy[i].name);
>> +		return 0;
> 
> Improved error checking, but quick and dirty:
> 
> +	if (!strcmp(argv[1], "--show-strategies")) {

Oops, not really improved. This still needs to check for argc >= 2.

> +		for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
> +			printf("%s\n", all_strategy[i].name);
> +		return argc == 2 ? 0 :
> +			 error("--show-strategies does not take "
> +				"any arguments");

-- Hannes

--
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]

  Powered by Linux