21 static inline char hexchar(
char h)
37 fprintf(f,
"%c%c", hexchar(*p >> 4), hexchar(*p & 0xf));
49 static inline int nibble(
char h)
54 return (h & ~(
'a' -
'A')) -
'A' + 10;
62 char *q = strchr(s,
':');
71 while (isspace((
int) *s))
76 if (
'0' == s[0] &&
'x' == s[1])
79 if (isxdigit((
int) s[0]) && isxdigit((
int) s[1])) {
81 return 16 * nibble(s[0]) | nibble(s[1]);
85 s = *p = strchr(s,
'\n');
int hex_dump_to_file(FILE *f, unsigned char *p, size_t sz)
int hex_dump(unsigned char *p, size_t sz)
int hex_get_byte(const char *s, const char **p)