summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-03-19 21:43:11 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-03-19 21:43:11 +0100
commitd1a6c3d98b3f62166b044ff1490589c11846bf6e (patch)
treea4ec14b46041ed8e894b37e5bacde81c45ebb973
parentba59f1020040d31fbe7a8109e6fc489d978087fc (diff)
downloadipecamera-d1a6c3d98b3f62166b044ff1490589c11846bf6e.tar.gz
ipecamera-d1a6c3d98b3f62166b044ff1490589c11846bf6e.tar.bz2
ipecamera-d1a6c3d98b3f62166b044ff1490589c11846bf6e.tar.xz
ipecamera-d1a6c3d98b3f62166b044ff1490589c11846bf6e.zip
Correctly detect hex numbers starting from 0x
-rw-r--r--tools.c6
1 files changed, 5 insertions, 1 deletions
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;
}