From: Jens Axboe Date: Mon, 30 Jul 2007 07:07:04 +0000 (+0200) Subject: Parser: make check_int() accept hex input if prefixed with 0x X-Git-Tag: fio-1.17~25 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a61bdfd8846317f431c318e0fe1fb841084ca9ea;hp=a59e170d683f9ccbaa45648d7ae9a13b70e3822c Parser: make check_int() accept hex input if prefixed with 0x Signed-off-by: Jens Axboe --- diff --git a/parse.c b/parse.c index f0e644f1..6fd617ce 100644 --- a/parse.c +++ b/parse.c @@ -188,8 +188,13 @@ static int check_int(const char *p, int *val) { if (!strlen(p)) return 1; - if (sscanf(p, "%u", val) == 1) - return 0; + if (strstr(p, "0x")) { + if (sscanf(p, "%x", val) == 1) + return 0; + } else { + if (sscanf(p, "%u", val) == 1) + return 0; + } return 1; }