shell: improve parse_hex() to use new stdio implementation

tags/0.1.0
S.J.R. van Schaik 7 years ago
parent de701429a7
commit 7536a6878b
  1. 11
      source/shell/flash.c

@ -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);
}

Loading…
Cancel
Save