10static long int fromhex(
unsigned char c)
14 else if (c>=
'A' && c<=
'F')
16 else if (c>=
'a' && c<=
'f')
21unsigned int scan_0x(
const char *s,
unsigned int *u)
24 unsigned long result = 0;
27 while ((c =
fromhex((
unsigned char) (s[pos]))) >= 0) {
28 result = (result << 4) + c;
38 unsigned long result = 0;
41 while ((c = (
unsigned long) (
unsigned char) (s[pos] -
'0')) < 8) {
42 result = result * 8 + c;
49unsigned int scan_uint(
const char *s,
unsigned int *u)
61 if (*s ==
'+') { *sign = 1;
return 1; }
62 if (*s ==
'-') { *sign = -1;
return 1; }
74 if (sign < 0) *i = -u;
else *i = u;
82 unsigned long result = 0;
85 while ((c = (
unsigned long) (
unsigned char) (s[pos] -
'0')) < 10) {
86 result = result * 10 + c;
99 while ((c =
fromhex(*t)) < 16) {
113 while ((l >> (
sizeof(l)*8 - 4)) == 0
114 && (c = (
unsigned char)
fromhex((
unsigned char)*t))<16) {
119 return (
unsigned int)(t-s);
unsigned int scan_xlong(const char *s, unsigned long *u)
unsigned int scan_uint(const char *s, unsigned int *u)
unsigned int scan_ulong(const char *s, unsigned long *u)
unsigned int scan_plusminus(const char *s, int *sign)
unsigned int scan_xint(const char *s, unsigned int *i)
unsigned int scan_long(const char *s, long *i)
unsigned int scan_8long(const char *s, unsigned long *u)
unsigned int scan_0x(const char *s, unsigned int *u)
int fromhex(unsigned char)