[sheepdog] [PATCH] dog/vdi: add hexadecimal support for index option

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Jul 16 16:13:43 CEST 2014


At Tue, 15 Jul 2014 15:38:10 +0800,
Ruoyu wrote:
> 
> It is convenient if the user already knows a oid, no need to
> convert it to decimal index first.
> 
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/vdi.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 1443cf4..ec78a2c 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -2534,9 +2534,13 @@ static int vdi_parser(int ch, const char *opt)
>  		vdi_cmd_data.no_share = true;
>  		break;
>  	case 'i':
> -		vdi_cmd_data.index = strtol(opt, &p, 10);
> +		if (strncmp(opt, "0x", 2) == 0)
> +			vdi_cmd_data.index = strtol(opt, &p, 16);
> +		else
> +			vdi_cmd_data.index = strtol(opt, &p, 10);
>  		if (opt == p) {
> -			sd_err("The index must be an integer");
> +			sd_err("The index must be a decimal integer "
> +				"or a hexadecimal integer started with 0x");
>  			exit(EXIT_FAILURE);
>  		}
>  		break;
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list