cleanup formatting
1 parent f3e75c5 commit 7223c5eb4cbe33e3a01eb895327d703724f70183
@tundra tundra authored on 19 Jan 2020
Showing 1 changed file
View
60
tdump.c
/* DUMP.C - Dumps stdin To stdout In Hexadecimal Format
Copyright (C) 1986-2020, T.A. Daneliuk
/* tdump - Dumps stdin To stdout In Hexadecimal Format
Copyright (C) 1986-2020, T.A. Daneliuk
*/
 
#include <stdio.h>
#include <fcntl.h>
void main()
 
{
 
int c,count;
char array[4],equiv[WIDTH+1];
array[2]=' ';
array[3]='\0';
equiv[WIDTH]='\0';
count=WIDTH+1;
dl();
int c,count;
char array[4],equiv[WIDTH+1];
array[2]=' ';
array[3]='\0';
equiv[WIDTH]='\0';
count=WIDTH+1;
dl();
 
while ((c=getc(stdin)) != EOF)
{
if (! (--count))
 
void dl()
 
{
 
tohex2((int) (line & 0xffL),&lineno[4]);
tohex2((int) ((line >> 8) & 0xffL),&lineno[2]);
tohex2((int) ((line >> 16) & 0xffl),&lineno[0]);
fputs(lineno,stdout);
fputs(" => ",stdout);
 
tohex2((int) (line & 0xffL),&lineno[4]);
tohex2((int) ((line >> 8) & 0xffL),&lineno[2]);
tohex2((int) ((line >> 16) & 0xffl),&lineno[0]);
fputs(lineno,stdout);
fputs(" => ",stdout);
}
 
/*********************** Display ASCII Equivalents **************************/
 
 
char *equiv;
 
{
fputs(" | ",stdout);
fputs(equiv,stdout);
fputs(" |\n",stdout);
line=line + 0x10;
return(WIDTH);
fputs(" | ",stdout);
fputs(equiv,stdout);
fputs(" |\n",stdout);
line=line + 0x10;
return(WIDTH);
}
 
 
 
char array[];
 
{
 
int temp;
static char conv[]={"0123456789ABCDEF"};
int temp;
static char conv[]={"0123456789ABCDEF"};
 
temp=i;
temp=temp & 0x000f; /* Mask all but low nybble */
array[1]=conv[temp]; /* Use to index into conversion table */
temp=i; /* Now do high nybble */
temp=temp >> 4;
temp=temp & 0x000f;
array[0]=conv[temp];
temp=i;
temp=temp & 0x000f; /* Mask all but low nyble */
array[1]=conv[temp]; /* Use to index into conversion table */
temp=i; /* Now do high nyble */
temp=temp >> 4;
temp=temp & 0x000f;
array[0]=conv[temp];
 
}