From d1a6c3d98b3f62166b044ff1490589c11846bf6e Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sat, 19 Mar 2011 21:43:11 +0100 Subject: Correctly detect hex numbers starting from 0x --- tools.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools.c b/tools.c index 4609619..21f7736 100644 --- a/tools.c +++ b/tools.c @@ -17,8 +17,12 @@ int pcilib_isnumber(const char *str) { int pcilib_isxnumber(const char *str) { int i = 0; - for (i = 0; str[i]; i++) + + if ((str[0] == '0')&&((str[1] == 'x')||(str[1] == 'X'))) i += 2; + + for (; str[i]; i++) if (!isxdigit(str[i])) return 0; + return 1; } -- cgit v1.2.3