diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-03-19 21:43:11 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-03-19 21:43:11 +0100 |
commit | d1a6c3d98b3f62166b044ff1490589c11846bf6e (patch) | |
tree | a4ec14b46041ed8e894b37e5bacde81c45ebb973 | |
parent | ba59f1020040d31fbe7a8109e6fc489d978087fc (diff) | |
download | ipecamera-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; } |