Fix hexdump for non-printable characters

This commit is contained in:
Rodrigo Arias 2021-12-15 18:12:44 +01:00
parent ba18ada0ae
commit bb14becb75

9
sort.c
View File

@ -153,11 +153,18 @@ hexdump(uint8_t *buf, size_t size)
for(j=0; j<16; j++)
{
if(i+j < size && isprint(buf[i+j]))
if(i+j < size)
{
if(isprint(buf[i+j]))
fprintf(stderr, "%c", buf[i+j]);
else
fprintf(stderr, ".");
}
else
{
fprintf(stderr, " ");
}
}
fprintf(stderr, "\n");
}
}