It is convenient if the user already knows a oid, no need to
convert it to decimal index first.

Signed-off-by: Ruoyu <lian...@ucweb.com>
---
 dog/vdi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

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@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to