diff options
author | Ian C <ianc@noddybox.co.uk> | 2018-09-06 13:08:36 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2018-09-06 13:08:36 +0000 |
commit | 10280a648f9caa1836f9b461301467194d091787 (patch) | |
tree | 07b50c0c8937d28c31f736034c467fafcd3e40ae | |
parent | 188f93cc71ffcf3bcef8f9ebc723edfc236d938d (diff) |
Small change to hex so that divisible by 16 file length doesn't cause a blank
line.
-rw-r--r-- | hex.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -20,13 +20,16 @@ static void Dump(char *fn,FILE *fp) { strcpy(s," "); - printf("%6.6x: ",p); - p+=16; - for(f=0;f<16;f++) { if((b!=EOF)&&((b=getc(fp))!=EOF)) { + if (f == 0) + { + printf("%6.6x: ",p); + p+=16; + } + printf("%2.2x ",(unsigned char)b); if (isprint(b)) @@ -40,6 +43,11 @@ static void Dump(char *fn,FILE *fp) } else { + if (f == 0) + { + return; + } + printf("** "); } } |