shell: improve parse_hex() to use new stdio implementation
This commit is contained in:
parent
de701429a7
commit
7536a6878b
1 changed files with 2 additions and 9 deletions
|
@ -23,15 +23,8 @@ static void parse_hex(FILE *fp, char *buf, size_t len)
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
memset(s, '\0', 3);
|
memset(s, '\0', 3);
|
||||||
|
|
||||||
while ((s[0] = getc(fp)) && !isxdigit(s[0]))
|
while ((s[0] = getc(fp)) && !isxdigit(s[0]));
|
||||||
putchar(s[0]);
|
while ((s[1] = getc(fp)) && !isxdigit(s[1]));
|
||||||
|
|
||||||
putchar(s[0]);
|
|
||||||
|
|
||||||
while ((s[1] = getc(fp)) && !isxdigit(s[1]))
|
|
||||||
putchar(s[1]);
|
|
||||||
|
|
||||||
putchar(s[1]);
|
|
||||||
|
|
||||||
*buf++ = strtoul(s, NULL, 16);
|
*buf++ = strtoul(s, NULL, 16);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue