From: Eric S. Raymond Date: Mon, 3 Dec 2012 20:03:05 +0000 (-0500) Subject: Use C99 booleans. X-Git-Tag: 1.8~10 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=53889e6bdc6e6ddd675847e6935c39548990342a;p=hexdump.git Use C99 booleans. --- diff --git a/hexdump.c b/hexdump.c index c158a7f..b3a84c5 100644 --- a/hexdump.c +++ b/hexdump.c @@ -9,18 +9,15 @@ hexdump.c -- generate CP/M style hex dumps #include #include #include +#include #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: