summaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/hex.c b/hex.c
index 39076be..1f9ba08 100644
--- a/hex.c
+++ b/hex.c
@@ -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("** ");
}
}