>From db1369223482779c0dd9b2da54905f06a24ef54d Mon Sep 17 00:00:00 2001 From: Liu Aleaxander <Aleaxander@xxxxxxxxx> Date: Wed, 24 Mar 2010 14:37:14 +0800 Subject: [PATCH] mount: make the --offset option support hex number Sometimes the hex number makes more sense. Signed-off-by: Liu Aleaxander <Aleaxander@xxxxxxxxx> --- mount/lomount.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mount/lomount.c b/mount/lomount.c index 67712c6..f6968b7 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -1015,8 +1015,15 @@ main(int argc, char **argv) { usage(); } - if (offset && sscanf(offset, "%llu", &off) != 1) - usage(); + if (offset) { + int ret = 0; + if (offset[0] == '0' && offset[1] == 'x') + ret = sscanf(offset, "%llx", &off); + else + ret = sscanf(offset, "%llu", &off); + if (ret != 1) + usage(); + } if (sizelimit && sscanf(sizelimit, "%llu", &slimit) != 1) usage(); -- 1.6.0.2 -- regards Liu Aleaxander -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html