]> thyrsus.com Git - hexdump.git/commitdiff
Fully ANSIfy the rather archaic C.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 20 Oct 2010 04:17:25 +0000 (00:17 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 20 Oct 2010 04:17:25 +0000 (00:17 -0400)
hexdump.c
hexdump.spec

index bd48937445480dbed772d7922e2b80dd071339a7..c158a7f0bd2fc2badf1522d8eb7c68902de98a7e 100644 (file)
--- 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 <stdio.h>
 #include <ctype.h>
 #include <string.h>
 #include <locale.h>
+#include <stdlib.h>
 
 #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 */
index 5b678e92da1e47eaf6bf1f8076204c2a661e78a2..99c2ef11cc5a61d0a321e1d2099e0641b3e2db22 100644 (file)
@@ -37,6 +37,7 @@ cp hexdump.1 "$RPM_BUILD_ROOT"/usr/share/man/man1/
 
 %changelog
 * Wed Oct 20 2010 Eric S. Raymond <esr@snark.thyrsus.com> 1.7-1
+- Code fully ANSIfied.
 - License changed to BSD.
 
 * Mon Dec 29 2003 Eric S. Raymond <esr@snark.thyrsus.com> 1.6-1