]> thyrsus.com Git - hexdump.git/commitdiff
Rename a variable for clarity.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 3 Dec 2012 21:37:49 +0000 (16:37 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 3 Dec 2012 21:37:49 +0000 (16:37 -0500)
hexdump.c

index ae5d9f902d896b8444f9eba9b983a1c45fab0f0e..e2fbbba68fcc43b92f5c6ec39573787321daaa92 100644 (file)
--- a/hexdump.c
+++ b/hexdump.c
@@ -14,7 +14,7 @@ hexdump.c -- generate CP/M style hex dumps
 #define DEFWIDTH 16            /* Default # chars to show per line */
 #define MAXWIDTH 128           /* Maximum # of bytes per line  */
 
-static long    linesize = DEFWIDTH;    /* # of bytes to print per line */
+static long    linebytes = 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 */
@@ -67,16 +67,16 @@ static void dumpfile(FILE *f)
 
        if (ch != EOF)
        {
-           if (i++ % linesize == 0)
+           if (i++ % linebytes == 0)
            {
                (void) printf("%04x ", offset);
-               offset += linesize;
+               offset += linebytes;
                hpos = 5;
            }
 
            /* output one space for the mid-page gutter */
            if (!gflag)
-               if ((i - 1) % (linesize / 2) == 0)
+               if ((i - 1) % (linebytes / 2) == 0)
                {
                    (void) putchar(' ');
                    hpos++;
@@ -113,11 +113,11 @@ static void dumpfile(FILE *f)
        }
 
        /* At end-of-line or EOF, show ASCII or EBCDIC version of data. */
-       if (i && (ch == EOF || (i % linesize == 0)))
+       if (i && (ch == EOF || (i % linebytes == 0)))
        {
            if (!cflag)
            {
-               while (hpos < linesize * 3 + 7)
+               while (hpos < linebytes * 3 + 7)
                {
                    hpos++;
                    (void) putchar(' ');
@@ -127,7 +127,7 @@ static void dumpfile(FILE *f)
                (void) printf("%s", ascii);
            }
 
-           if (ch != EOF || (i % linesize != 0))
+           if (ch != EOF || (i % linebytes != 0))
                (void) putchar('\n');
            ai = 0;             /* reset counters */
        }
@@ -247,12 +247,12 @@ main(int argc, char **argv)
                    (*argv)++;
                else
                    argc--, argv++;
-               if ((linesize = getoffs(*argv)) == -1L || linesize > MAXWIDTH)
+               if ((linebytes = getoffs(*argv)) == -1L || linebytes > MAXWIDTH)
                {
                    (void) fputs("hex: line width no good\n", stderr);
                    exit(0);
                }
-               if (linesize % 2)
+               if (linebytes % 2)
                    gflag = true;
                continue;