shell: improve parse_hex() to use new stdio implementation

This commit is contained in:
S.J.R. van Schaik 2017-07-24 17:08:06 +02:00
parent de701429a7
commit 7536a6878b

View file

@ -23,15 +23,8 @@ static void parse_hex(FILE *fp, char *buf, size_t len)
for (i = 0; i < len; ++i) {
memset(s, '\0', 3);
while ((s[0] = getc(fp)) && !isxdigit(s[0]))
putchar(s[0]);
putchar(s[0]);
while ((s[1] = getc(fp)) && !isxdigit(s[1]))
putchar(s[1]);
putchar(s[1]);
while ((s[0] = getc(fp)) && !isxdigit(s[0]));
while ((s[1] = getc(fp)) && !isxdigit(s[1]));
*buf++ = strtoul(s, NULL, 16);
}