From: Eric S. Raymond Date: Wed, 20 Oct 2010 04:17:25 +0000 (-0400) Subject: Fully ANSIfy the rather archaic C. X-Git-Tag: 1.7~3 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=3ee524620c3caf8b7dda214f20dc23d3fac141b5;p=hexdump.git Fully ANSIfy the rather archaic C. --- diff --git a/hexdump.c b/hexdump.c index bd48937..c158a7f 100644 --- a/hexdump.c +++ b/hexdump.c @@ -1,14 +1,14 @@ /***************************************************************************** -hex.c -- generate CP/M style hex dumps +hexdump.c -- generate CP/M style hex dumps *****************************************************************************/ - #include #include #include #include +#include #define DEFWIDTH 16 /* Default # chars to show per line */ #define MAXWIDTH 32 /* Maximum # of bytes per line */ @@ -41,9 +41,8 @@ static char ebcdic[] = /* F0 */ '0','1','2','3','4','5','6','7','8','9','.','.','.','.','.','.', }; -static void dumpfile(f) +static void dumpfile(FILE *f) /* dump a single, specified file -- stdin if filename is NULL */ -FILE *f; { int ch = '\0'; /* current character */ char ascii[MAXWIDTH+3]; /* printable ascii data */ @@ -139,9 +138,8 @@ FILE *f; (ch != EOF); } -static long getoffs(cp) +static long getoffs(char *cp) /* fetch decimal or hex integer to be used as file start or offset */ -char *cp; { bool foundzero = FALSE; long value = 0; @@ -191,9 +189,7 @@ char *cp; return(value); } -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char **argv) { FILE *infile; /* file pointer input file */ int dumpcount = 0; /* count of files dumped so far */ @@ -290,4 +286,4 @@ char *argv[]; return(0); } -/* hex.c ends here */ +/* hexdump.c ends here */ diff --git a/hexdump.spec b/hexdump.spec index 5b678e9..99c2ef1 100644 --- a/hexdump.spec +++ b/hexdump.spec @@ -37,6 +37,7 @@ cp hexdump.1 "$RPM_BUILD_ROOT"/usr/share/man/man1/ %changelog * Wed Oct 20 2010 Eric S. Raymond 1.7-1 +- Code fully ANSIfied. - License changed to BSD. * Mon Dec 29 2003 Eric S. Raymond 1.6-1