]> thyrsus.com Git - hexdump.git/commitdiff
Use C99 booleans.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 3 Dec 2012 20:03:05 +0000 (15:03 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 3 Dec 2012 20:03:05 +0000 (15:03 -0500)
hexdump.c

index c158a7f0bd2fc2badf1522d8eb7c68902de98a7e..b3a84c59cdcc1a0264f7ae504417e1308974603c 100644 (file)
--- a/hexdump.c
+++ b/hexdump.c
@@ -9,18 +9,15 @@ hexdump.c -- generate CP/M style hex dumps
 #include <string.h>
 #include <locale.h>
 #include <stdlib.h>
+#include <stdbool.h>
 
 #define DEFWIDTH 16            /* Default # chars to show per line */
 #define MAXWIDTH 32            /* Maximum # of bytes per line  */
 
-typedef int bool;
-#define TRUE   1
-#define FALSE  0
-
 static long    linesize = DEFWIDTH;    /* # of bytes to print per line */
-static bool    eflag = FALSE;          /* display ebcdic if true */
-static bool    cflag = FALSE;          /* show printables as ASCII if true */
-static bool    gflag = FALSE;          /* suppress mid-page gutter if true */
+static bool    eflag = false;          /* display ebcdic if true */
+static bool    cflag = false;          /* show printables as ASCII if true */
+static bool    gflag = false;          /* suppress mid-page gutter if true */
 static long    start = 0L;             /* file offset to start dumping at */
 static long    length = 0L;            /* if nz, how many chars to dump */
 
@@ -141,14 +138,14 @@ static void dumpfile(FILE *f)
 static long getoffs(char *cp)
 /* fetch decimal or hex integer to be used as file start or offset */
 {
-    bool foundzero = FALSE;
+    bool foundzero = false;
     long value = 0;
     int base = 0;
     char *hexdigits = "0123456789abcdefABCDEF";
 
     for (; *cp; cp++)
        if (*cp == '0')
-           foundzero = TRUE;
+           foundzero = true;
        else if (isdigit(*cp))
        {
            base = 10;
@@ -256,7 +253,7 @@ main(int argc, char **argv)
                    exit(0);
                }
                if (linesize % 2)
-                   gflag = TRUE;
+                   gflag = true;
                continue;
 
            default: