diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 09:53:45 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-07-12 09:53:45 +0200 |
commit | de984f8b9706cfac79f7658e5b3863e78b052458 (patch) | |
tree | f989701212bb2de4d224387344929853e4055d27 /tools.c | |
parent | 5b4fbcc62d4544aee7adf0a92a2db31197bae305 (diff) | |
download | ipecamera-de984f8b9706cfac79f7658e5b3863e78b052458.tar.gz ipecamera-de984f8b9706cfac79f7658e5b3863e78b052458.tar.bz2 ipecamera-de984f8b9706cfac79f7658e5b3863e78b052458.tar.xz ipecamera-de984f8b9706cfac79f7658e5b3863e78b052458.zip |
Suppport DMA modes in console application (not functional yet)
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -26,6 +26,24 @@ int pcilib_isxnumber(const char *str) { return 1; } +int pcilib_isnumber_n(const char *str, size_t len) { + int i = 0; + for (i = 0; (str[i])&&(i < len); i++) + if (!isdigit(str[i])) return 0; + return 1; +} + +int pcilib_isxnumber_n(const char *str, size_t len) { + int i = 0; + + if ((len > 1)&&(str[0] == '0')&&((str[1] == 'x')||(str[1] == 'X'))) i += 2; + + for (; (str[i])&&(i < len); i++) + if (!isxdigit(str[i])) return 0; + + return 1; +} + uint16_t pcilib_swap16(uint16_t x) { return (((x<<8)&0xFFFF) | ((x>>8)&0xFFFF)); |