projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
853ee7f
)
Allow 0x (or 0X) prefix for any int value to indicate hex base
author
Jens Axboe
<jens.axboe@oracle.com>
Mon, 9 Mar 2009 13:15:21 +0000
(14:15 +0100)
committer
Jens Axboe
<jens.axboe@oracle.com>
Mon, 9 Mar 2009 13:15:21 +0000
(14:15 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c
patch
|
blob
|
blame
|
history
diff --git
a/parse.c
b/parse.c
index d653f5e489458236a6d441a1157fab15396314ed..4c6a9ea984ee28475c0f47eeabec549d68e7c55e 100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-112,13
+112,18
@@
static unsigned long get_mult_bytes(char c)
*/
int str_to_decimal(const char *str, long long *val, int kilo)
{
- int len;
+ int len
, base
;
len = strlen(str);
if (!len)
return 1;
- *val = strtoll(str, NULL, 10);
+ if (strstr(str, "0x") || strstr(str, "0X"))
+ base = 16;
+ else
+ base = 10;
+
+ *val = strtoll(str, NULL, base);
if (*val == LONG_MAX && errno == ERANGE)
return 1;