about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/pbm/pbmtobbnbg.c24
-rw-r--r--converter/ppm/gouldtoppm.c179
-rw-r--r--converter/ppm/ppmtoacad.c56
-rw-r--r--editor/ppmdim.c11
-rw-r--r--editor/ppmflash.c16
-rw-r--r--editor/specialty/ppmtv.c162
-rw-r--r--lib/pm.h23
-rw-r--r--lib/util/bitio.c66
-rw-r--r--netpbm.c8
9 files changed, 273 insertions, 272 deletions
diff --git a/converter/pbm/pbmtobbnbg.c b/converter/pbm/pbmtobbnbg.c
index f9191a49..9608f5f1 100644
--- a/converter/pbm/pbmtobbnbg.c
+++ b/converter/pbm/pbmtobbnbg.c
@@ -17,15 +17,12 @@
 
 #include "pbm.h"
 
-static void write16 ARGS(( unsigned int ));
+static void write16 ( unsigned int word );
 
 static int nco;
 
 int
-main(argc,argv)
-int argc;
-char **argv;
-{
+main(int argc, char ** argv) {
  int rows;
  int cols;
  int format;
@@ -89,9 +86,7 @@ char **argv;
 
 #ifdef POSITIVE_VALUES_ONLY
 static void
-write16(sixteen)
-unsigned int sixteen;
-{
+write16(unsigned int sixteen) {
  if (nco > 75)
   { putchar('\n');
     nco = 0;
@@ -107,6 +102,9 @@ unsigned int sixteen;
  putchar(060+(sixteen&0xf));
  nco ++;
 }
+
+
+
 #else
 /*
  *  This version of "write16" uses negative Packed Pixel Data values to
@@ -114,9 +112,8 @@ unsigned int sixteen;
  *  require fewer characters as they approach the upper end of that range.
  */
 static void
-write16 (word)
-unsigned int    word;
-{
+write16 (unsigned int word) {
+
     int         high;
     int         mid;
     int         low;
@@ -128,7 +125,7 @@ unsigned int    word;
     }
 
     if (word > 0x7fff) {
-        word = (unsigned int) (0x10000L - (long) word);
+        word = (unsigned int) (0x10000L - (long int) word);
         signChar = ' ';
     }
     else
@@ -152,3 +149,6 @@ unsigned int    word;
     }
 }
 #endif
+
+
+
diff --git a/converter/ppm/gouldtoppm.c b/converter/ppm/gouldtoppm.c
index 6cc7726c..d085d5f0 100644
--- a/converter/ppm/gouldtoppm.c
+++ b/converter/ppm/gouldtoppm.c
@@ -15,112 +15,123 @@
 
 #define MAXVAL 255
 
-static void getgouldheader ARGS(( FILE *infile, unsigned long *cols, unsigned long *nlines, unsigned long *bytesperline, unsigned long *bitsperpixel, unsigned long *NB ));
+static void getgouldheader ( FILE *infile,
+                             unsigned long int *cols,
+                             unsigned long int *nlines,
+                             unsigned long int *bytesperline,
+                             unsigned long int *bitsperpixel,
+                             unsigned long int *NB );
+
+
 
 int
-main( argc, argv )
-int argc;
-char *argv[];
-{
-        FILE *ifp;
-        pixel *pixrow;
+main( int argc, char * argv[] ) {
+
+    FILE *ifp;
+    pixel *pixrow;
 
-        unsigned long cols, nlines, bytesperline, bitsperpixel, NB, x, y;
-        unsigned char pbuffer[4];
+    unsigned long int cols, nlines, bytesperline, bitsperpixel, NB, x, y;
+    unsigned char pbuffer[4];
 
-        int color_type;
+    int color_type;
 
 
-        ppm_init( &argc, argv );
+    ppm_init( &argc, argv );
 
-        if ( argc > 2 )
-                pm_usage( "[gouldfile]" );
+    if ( argc > 2 )
+        pm_usage( "[gouldfile]" );
 
-        if ( argc == 2 )
-                ifp = pm_openr( argv[1] );
-        else
-                ifp = stdin;
+    if ( argc == 2 )
+        ifp = pm_openr( argv[1] );
+    else
+        ifp = stdin;
 
-        getgouldheader( ifp, &cols, &nlines, &bytesperline, &bitsperpixel, &NB);
+    getgouldheader( ifp, &cols, &nlines, &bytesperline, &bitsperpixel, &NB);
 
-        ppm_writeppminit(stdout, cols, nlines, MAXVAL, 0);
+    ppm_writeppminit(stdout, cols, nlines, MAXVAL, 0);
 
-        color_type = bitsperpixel/8;
-        if (color_type == 0) color_type = NB;
+    color_type = bitsperpixel/8;
+    if (color_type == 0) color_type = NB;
 
-        pixrow = ppm_allocrow(cols);
+    pixrow = ppm_allocrow(cols);
 
-        for (y = 0; y < nlines; ++y)
+    for (y = 0; y < nlines; ++y)
+    {
+        for (x = 0; x < cols; ++x)
         {
-                for (x = 0; x < cols; ++x)
-                {
-                        switch (color_type)
-                        {
-                        case 0:
-                                pm_error("incorrect color type" );
-
-                        case 1:
-                                fread(pbuffer, 1, 1, ifp);
-                                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[0], pbuffer[0]);
-                                break;
-
-                        case 2:
-                                fread(pbuffer, 2, 1, ifp);
-                                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[1]);
-                                break;
-
-                        case 3:
-                                fread(pbuffer, 3, 1, ifp);
-                                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[2]);
-                                break;
-
-                        default :
-                                fread(pbuffer, 3, 1, ifp);
-                                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[2]);
-                                break;
-
-                        } /* switch */
-                }
-                ppm_writeppmrow(stdout, pixrow, cols, MAXVAL, 0);
+            switch (color_type)
+            {
+            case 0:
+                pm_error("incorrect color type" );
+
+            case 1:
+                fread(pbuffer, 1, 1, ifp);
+                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[0], pbuffer[0]);
+                break;
+
+            case 2:
+                fread(pbuffer, 2, 1, ifp);
+                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[1]);
+                break;
+
+            case 3:
+                fread(pbuffer, 3, 1, ifp);
+                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[2]);
+                break;
+
+            default :
+                fread(pbuffer, 3, 1, ifp);
+                PPM_ASSIGN( pixrow[x], pbuffer[0], pbuffer[1], pbuffer[2]);
+                break;
+
+            } /* switch */
         }
+        ppm_writeppmrow(stdout, pixrow, cols, MAXVAL, 0);
+    }
 
-        pm_close(ifp);
-        pm_close(stdout);
+    pm_close(ifp);
+    pm_close(stdout);
 
-        exit(0);
+    exit(0);
 }
 
 
 
 static void
-getgouldheader( infile, cols, nlines, bytesperline, bitsperpixel, NB)
-FILE *infile;
-unsigned long *cols, *nlines, *bytesperline, *bitsperpixel, *NB;
-{
-        unsigned long nlines_new, bytesperline_new, numheaderrec;
-        unsigned char headerblk[512];
-        int i;
-
-        if (fread(headerblk, 512, 1, infile) == 0)
-                pm_error("cannot read gould header" );
-
-        *nlines       = (headerblk[3]<<8) | headerblk[2];
-        *bytesperline = (headerblk[5]<<8) | headerblk[4];
-        *bitsperpixel = (headerblk[7]<<8) | headerblk[6];
-        numheaderrec  = (headerblk[9]<<8) | headerblk[8];
-        nlines_new    = (headerblk[15]<<24)| (headerblk[14]<<16) | (headerblk[13]<<8) | (headerblk[12]);
-        bytesperline_new = (headerblk[19]<<24)| (headerblk[18]<<16) | (headerblk[17]<<8) | (headerblk[16]);
-        *NB           = (headerblk[23]<<24)| (headerblk[22]<<16) | (headerblk[21]<<8) | (headerblk[20]);
-
-        if (numheaderrec > 1)
-                for (i = 1 ; i <numheaderrec; ++i)
-                        if (fread(headerblk, 512, 1, infile) == 0)
-                                pm_error("cannot read gould header(2nd)" );
-
-        if (*nlines==0) *nlines=nlines_new;
-        if (*bytesperline==0) *bytesperline=bytesperline_new;
-
-        *cols = (*bytesperline)*8 / (*bitsperpixel);
+getgouldheader(FILE * infile,
+               unsigned long int *cols,
+               unsigned long int *nlines,
+               unsigned long int *bytesperline,
+               unsigned long int *bitsperpixel,
+               unsigned long int *NB ) {
+
+    unsigned long int nlines_new, bytesperline_new, numheaderrec;
+    unsigned char headerblk[512];
+    int i;
+
+    if (fread(headerblk, 512, 1, infile) == 0)
+        pm_error("cannot read gould header" );
+
+    *nlines       = (headerblk[3]<<8) | headerblk[2];
+    *bytesperline = (headerblk[5]<<8) | headerblk[4];
+    *bitsperpixel = (headerblk[7]<<8) | headerblk[6];
+    numheaderrec  = (headerblk[9]<<8) | headerblk[8];
+    nlines_new    = (headerblk[15]<<24)| (headerblk[14]<<16) |\
+                    (headerblk[13]<<8) | (headerblk[12]);
+    bytesperline_new = (headerblk[19]<<24)| (headerblk[18]<<16) |\
+                       (headerblk[17]<<8) | (headerblk[16]);
+    *NB           = (headerblk[23]<<24)| (headerblk[22]<<16) |\
+                    (headerblk[21]<<8) | (headerblk[20]);
+
+    if (numheaderrec > 1)
+        for (i = 1 ; i <numheaderrec; ++i)
+            if (fread(headerblk, 512, 1, infile) == 0)
+                pm_error("cannot read gould header(2nd)" );
+
+    if (*nlines==0) *nlines=nlines_new;
+    if (*bytesperline==0) *bytesperline=bytesperline_new;
+
+    *cols = (*bytesperline)*8 / (*bitsperpixel);
 }
 
 
diff --git a/converter/ppm/ppmtoacad.c b/converter/ppm/ppmtoacad.c
index 4f4dc5dd..1bc91640 100644
--- a/converter/ppm/ppmtoacad.c
+++ b/converter/ppm/ppmtoacad.c
@@ -40,16 +40,29 @@ static int gamut = 256;               /* Output color gamut */
 #include "autocad.h"                  /* AutoCAD standard color assignments */
 
 /* prototypes */
-static void outrun ARGS((int color, int ysize, int y, int xstart, int xend));
-static void slideout ARGS((int xdots, int ydots, int ncolors,
-        unsigned char *red, unsigned char *green, unsigned char *blue));
+static void outrun (int const color,
+                    int const ysize,
+                    int const y,
+                    int const xstart,
+                    int const xend);
+
+static void slideout (int const xdots,
+                      int const ydots,
+                      int const ncolors,
+                      unsigned char *red,
+                      unsigned char *green,
+                      unsigned char *blue);
 
 
 /*  OUTRUN  --  Output a run of pixels. */
 
-static void outrun(color, ysize, y, xstart, xend)
-  int color, ysize, y, xstart, xend;
-{
+static void
+outrun (int const color,
+        int const ysize,
+        int const y,
+        int const xstart,
+        int const xend) {
+
     if (color == 0) {
         return;                       /* Let screen background handle this */
     }
@@ -151,10 +164,14 @@ static void outrun(color, ysize, y, xstart, xend)
 
 /*  SLIDEOUT  --  Write an AutoCAD slide.  */
 
-static void slideout(xdots, ydots, ncolors, red, green, blue)
-  int xdots, ydots, ncolors;
-  unsigned char *red, *green, *blue;
-{
+static void
+slideout (int const xdots,
+          int const ydots,
+          int const ncolors,
+          unsigned char *red,
+          unsigned char *green,
+          unsigned char *blue) {
+
     static char sldhead[18] = "AutoCAD Slide\r\n\32";
     static char dxbhead[20] = "AutoCAD DXB 1.0\r\n\32";
     unsigned char *acadmap;
@@ -187,7 +204,7 @@ static void slideout(xdots, ydots, ncolors, red, green, blue)
         (void) pm_writelittleshort(stdout, ysize); /* Max Y co-ordinate value */
                                       /* Aspect ratio indicator */
         (void) pm_writelittlelong(
-            stdout, (long) ((((double) xsize) / ysize) * aspect * 1E7));
+            stdout, (long int) ((((double) xsize) / ysize) * aspect * 1E7));
         (void) pm_writelittleshort(stdout, 2);        /* Polygon fill type */
         (void) pm_writelittleshort(stdout, 0x1234);   /* Byte order indicator */
     }
@@ -198,13 +215,13 @@ static void slideout(xdots, ydots, ncolors, red, green, blue)
 
     for (i = 0; i < ncolors; i++) {
         int best, j;
-        long dist = 3 * 256 * 256;
+        long int dist = 3 * 256 * 256;
 
         for (j = 0; j < gamut; j++) {
-            long dr = red[i] - acadcol[j][0],
-                 dg = green[i] - acadcol[j][1],
-                 db = blue[i] - acadcol[j][2];
-            long tdist = dr * dr + dg * dg + db * db;
+            long int const dr = red[i] - acadcol[j][0],
+                     dg = green[i] - acadcol[j][1],
+                     db = blue[i] - acadcol[j][2];
+            long int const tdist = dr * dr + dg * dg + db * db;
 
             if (tdist < dist) {
                 dist = tdist;
@@ -265,10 +282,8 @@ static void slideout(xdots, ydots, ncolors, red, green, blue)
 
 /*  Main program.  */
 
-int main(argc, argv)
-  int argc;
-  char* argv[];
-{
+int main(int argc, char* argv[]) {
+
     FILE *ifp;
     int argn, rows, cols, ncolors, i;
     int aspectspec = FALSE;
@@ -279,7 +294,6 @@ int main(argc, argv)
         "[-poly] [-dxb] [-white] [-background <col>]\n\
                   [-aspect <f>] [-8] [ppmfile]";
 
-
     ppm_init(&argc, argv);
 
     argn = 1;
diff --git a/editor/ppmdim.c b/editor/ppmdim.c
index 0bcc8ebb..30e66e8a 100644
--- a/editor/ppmdim.c
+++ b/editor/ppmdim.c
@@ -24,17 +24,16 @@ static char *version = "$VER: ppmdim 1.4 (16.11.93)"; /* Amiga version identific
 /**************************/
 /* start of main function */
 /**************************/
-int main(argc, argv)
-int argc;
-char *argv[];
-{
+int
+main(int argc, char * argv[]) {
+
         FILE* ifp;
         int argn, rows, cols, format, i = 0, j = 0;
         pixel *srcrow, *destrow;
         pixel *pP = NULL, *pP2 = NULL;
         pixval maxval;
         double dimfactor;
-        long longfactor;
+        long int longfactor;
         const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
 
         /* parse in 'default' parameters */
@@ -109,3 +108,5 @@ char *argv[];
         exit(0);
 }
 
+
+
diff --git a/editor/ppmflash.c b/editor/ppmflash.c
index c8335890..e9e2b1ad 100644
--- a/editor/ppmflash.c
+++ b/editor/ppmflash.c
@@ -24,17 +24,16 @@ static char *version = "$VER: ppmflash 1.4 (16.11.93)";
 /**************************/
 /* start of main function */
 /**************************/
-int main(argc, argv)
-    int argc;
-    char *argv[];
-{
+int
+main(int argc, char *argv[]) {
+
     FILE* ifp;
     int argn, rows, cols, i, j, format;
     pixel *srcrow, *destrow;
     pixel *pP, *pP2;
     pixval maxval;
     double flashfactor;
-    long longfactor;
+    long int longfactor;
     const char* const usage = "flashfactor [ppmfile]\n        flashfactor: 0.0 = original picture, 1.0 = total whiteout\n";
 
     /* parse in 'default' parameters */
@@ -52,8 +51,7 @@ int main(argc, argv)
     ++argn;
 
     /* parse in filename (if present, stdin otherwise) */
-    if (argn != argc)
-    {
+    if (argn != argc) {
         ifp = pm_openr(argv[argn]);
         ++argn;
     }
@@ -69,7 +67,7 @@ int main(argc, argv)
     /* no error checking required here, ppmlib does it all for us */
     srcrow = ppm_allocrow(cols);
 
-    longfactor = (long)(flashfactor * 65536);
+    longfactor = (long int)(flashfactor * 65536);
 
     /* allocate a row of pixel data for the new pixels */
     destrow = ppm_allocrow(cols);
@@ -111,3 +109,5 @@ int main(argc, argv)
     exit(0);
 }
 
+
+
diff --git a/editor/specialty/ppmtv.c b/editor/specialty/ppmtv.c
index 7e540e34..af813af5 100644
--- a/editor/specialty/ppmtv.c
+++ b/editor/specialty/ppmtv.c
@@ -13,92 +13,88 @@
 /**************************/
 /* start of main function */
 /**************************/
-int main(argc, argv)
-int argc;
-char *argv[];
-{
-        FILE* ifp;
-        int argn, rows, cols, format, i = 0, j = 0;
-        pixel *srcrow, *destrow;
-        pixel *pP = NULL, *pP2 = NULL;
-        pixval maxval;
-        double dimfactor;
-        long longfactor;
-        const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
-
-        /* parse in 'default' parameters */
-        ppm_init(&argc, argv);
-
-        argn = 1;
-
-        /* parse in dim factor */
-        if (argn == argc)
-                pm_usage(usage);
-        if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
-                pm_usage(usage);
-        if (dimfactor < 0.0 || dimfactor > 1.0)
-                pm_error("dim factor must be in the range from 0.0 to 1.0 ");
+int
+main(int argc, char * argv[]) {
+
+    FILE* ifp;
+    int argn, rows, cols, format, i = 0, j = 0;
+    pixel *srcrow, *destrow;
+    pixel *pP = NULL, *pP2 = NULL;
+    pixval maxval;
+    double dimfactor;
+    long int longfactor;
+    const char * const usage = "dimfactor [ppmfile]\n        dimfactor: 0.0 = total blackness, 1.0 = original picture\n";
+
+    /* parse in 'default' parameters */
+    ppm_init(&argc, argv);
+
+    argn = 1;
+
+    /* parse in dim factor */
+    if (argn == argc)
+        pm_usage(usage);
+    if (sscanf(argv[argn], "%lf", &dimfactor) != 1)
+        pm_usage(usage);
+    if (dimfactor < 0.0 || dimfactor > 1.0)
+        pm_error("dim factor must be in the range from 0.0 to 1.0 ");
+    ++argn;
+
+    /* parse in filename (if present, stdin otherwise) */
+    if (argn != argc) {
+        ifp = pm_openr(argv[argn]);
         ++argn;
-
-        /* parse in filename (if present, stdin otherwise) */
-        if (argn != argc)
-        {
-                ifp = pm_openr(argv[argn]);
-                ++argn;
-        }
-        else
-                ifp = stdin;
-
-        if (argn != argc)
-                pm_usage(usage);
-
-        /* read first data from file */
-        ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
-
-        /* no error checking required here, ppmlib does it all for us */
-        srcrow = ppm_allocrow(cols);
-
-        longfactor = (long)(dimfactor * 65536);
-
-        /* allocate a row of pixel data for the new pixels */
-        destrow = ppm_allocrow(cols);
-
-        ppm_writeppminit(stdout, cols, rows, maxval, 0);
-
-        /** now do the ntsc'ing (actually very similar to ppmdim) **/
-        for (i = 0; i < rows; i++)
-        {
-                ppm_readppmrow(ifp, srcrow, cols, maxval, format);
-
-                pP = srcrow;
-                pP2 = destrow;
-
-                for (j = 0; j < cols; j++)
-                {
-                        /* every alternating row is left in unchanged condition */
-                        if (i & 1)
-                        {
-                                PPM_ASSIGN(*pP2, PPM_GETR(*pP), PPM_GETG(*pP), PPM_GETB(*pP));
-                        }
-                        /* and the other lines are dimmed to the specified factor */
-                        else
-                        {
-                                PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
-                                                                 (PPM_GETG(*pP) * longfactor) >> 16,
-                                                                 (PPM_GETB(*pP) * longfactor) >> 16);
-                        }
-                        pP++;
-                        pP2++;
-                }
-
-                /* write out one line of graphic data */
-                ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
+    }
+    else
+        ifp = stdin;
+
+    if (argn != argc)
+        pm_usage(usage);
+
+    /* read first data from file */
+    ppm_readppminit(ifp, &cols, &rows, &maxval, &format);
+
+    /* no error checking required here, ppmlib does it all for us */
+    srcrow = ppm_allocrow(cols);
+
+    longfactor = (long int) (dimfactor * 65536);
+
+    /* allocate a row of pixel data for the new pixels */
+    destrow = ppm_allocrow(cols);
+
+    ppm_writeppminit(stdout, cols, rows, maxval, 0);
+
+    /** now do the ntsc'ing (actually very similar to ppmdim) **/
+    for (i = 0; i < rows; i++) {
+        ppm_readppmrow(ifp, srcrow, cols, maxval, format);
+
+        pP = srcrow;
+        pP2 = destrow;
+
+        for (j = 0; j < cols; j++) {
+            /* every alternating row is left in unchanged condition */
+            if (i & 1) {
+                PPM_ASSIGN(*pP2, PPM_GETR(*pP), PPM_GETG(*pP), PPM_GETB(*pP));
+            }
+            /* and the other lines are dimmed to the specified factor */
+            else {
+                PPM_ASSIGN(*pP2, (PPM_GETR(*pP) * longfactor) >> 16,
+                                 (PPM_GETG(*pP) * longfactor) >> 16,
+                                 (PPM_GETB(*pP) * longfactor) >> 16);
+            }
+            pP++;
+            pP2++;
         }
 
-        pm_close(ifp);
-        ppm_freerow(srcrow);
-        ppm_freerow(destrow);
+        /* write out one line of graphic data */
+        ppm_writeppmrow(stdout, destrow, cols, maxval, 0);
+    }
+
+    pm_close(ifp);
+    ppm_freerow(srcrow);
+    ppm_freerow(destrow);
 
-        exit(0);
+    exit(0);
 }
 
+
+
diff --git a/lib/pm.h b/lib/pm.h
index 62ad5355..c81a9f20 100644
--- a/lib/pm.h
+++ b/lib/pm.h
@@ -31,29 +31,6 @@ extern "C" {
 #endif
 
 
-/* Definitions to make Netpbm programs work with either ANSI C or C
-   Classic.
-
-   This is obsolete, as all compilers recognize the ANSI syntax now.
-
-   We are slowly removing all the ARGS invocations from the programs
-   (and replacing them with explicit ANSI syntax), but we have a lot
-   of programs where we have removed ARGS from the definition but not
-   the prototype, and we have discovered that the Sun compiler
-   considers the resulting mismatch between definition and prototype
-   to be an error.  So we make ARGS create the ANSI syntax
-   unconditionally to avoid having to fix all those mismatches.  */
-
-#if 0
-#if __STDC__
-#define ARGS(alist) alist
-#else /*__STDC__*/
-#define ARGS(alist) ()
-#define const
-#endif /*__STDC__*/
-#endif
-#define ARGS(alist) alist
-
 
 /* PM_GNU_PRINTF_ATTR lets the GNU compiler check pm_message() and pm_error()
    calls to be sure the arguments match the format string, thus preventing
diff --git a/lib/util/bitio.c b/lib/util/bitio.c
index 9d96892c..ca78ebcb 100644
--- a/lib/util/bitio.c
+++ b/lib/util/bitio.c
@@ -1,4 +1,4 @@
-/*\
+/*                                                      \
  * $Id: bitio.c,v 1.5 1992/11/24 19:36:46 dws Exp dws $
  *
  * bitio.c - bitstream I/O
@@ -36,16 +36,11 @@
 
 #include "bitio.h"
 
-struct bitstream
-{
-    FILE *
-        f;      /* bytestream */
-    unsigned long
-        bitbuf;     /* bit buffer */
-    int
-        nbitbuf;    /* number of bits in 'bitbuf' */
-    char
-        mode;
+struct bitstream {
+    FILE * f;                     /* bytestream */
+    unsigned long int bitbuf;     /* bit buffer */
+    int nbitbuf;                  /* number of bits in 'bitbuf' */
+    char mode;                    /* read or write */
 };
 
 #define Mask(n)     ((1<<(n))-1)
@@ -67,7 +62,8 @@ struct bitstream
  */
 
 struct bitstream *
-pm_bitinit(FILE * const f, const char * const mode) {
+pm_bitinit(FILE       * const f,
+           const char * const mode) {
 
     struct bitstream * ans;
 
@@ -85,6 +81,8 @@ pm_bitinit(FILE * const f, const char * const mode) {
     return ans;
 }
 
+
+
 /*
  * pm_bitfini() - deallocate the given struct bitstream *.
  *
@@ -96,9 +94,8 @@ pm_bitinit(FILE * const f, const char * const mode) {
  */
 
 int
-pm_bitfini(b)
-    struct bitstream *b;
-{
+pm_bitfini(struct bitstream * const b) {
+
     int     nbyte = 0;
 
     if(!b)
@@ -121,8 +118,8 @@ pm_bitfini(b)
         {
             char    c;
 
-            BitPut(b, 0, (long)8-(b->nbitbuf));
-            c = (char) BitGet(b, (long)8);
+            BitPut(b, 0, (long int)8-(b->nbitbuf));
+            c = (char) BitGet(b, (long int)8);
             if(putc(c, b->f) == EOF)
             {
                 return -1;
@@ -135,6 +132,8 @@ pm_bitfini(b)
     return nbyte;
 }
 
+
+
 /*
  * pm_bitread() - read the next nbits into *val from the given file.
  *
@@ -144,11 +143,10 @@ pm_bitfini(b)
  */
 
 int
-pm_bitread(b, nbits, val)
-    struct bitstream *b;
-    unsigned long   nbits;
-    unsigned long  *val;
-{
+pm_bitread(struct bitstream  * const b,
+           unsigned long int   const nbits,
+           unsigned long int * const val) {
+
     int     nbyte = 0;
     int     c;
 
@@ -163,13 +161,15 @@ pm_bitread(b, nbits, val)
         }
         nbyte++;
 
-        BitPut(b, c, (long) 8);
+        BitPut(b, c, (long int) 8);
     }
 
     *val = BitGet(b, nbits);
     return nbyte;
 }
 
+
+
 /*
  * pm_bitwrite() - write the low nbits of val to the given file.
  *
@@ -179,11 +179,10 @@ pm_bitread(b, nbits, val)
  */
 
 int
-pm_bitwrite(b, nbits, val)
-    struct bitstream *b;
-    unsigned long   nbits;
-    unsigned long   val;
-{
+pm_bitwrite(struct bitstream * const b,
+            unsigned long int  const nbits,
+            unsigned long int  const val) {
+
     int     nbyte = 0;
     char        c;
 
@@ -192,12 +191,10 @@ pm_bitwrite(b, nbits, val)
 
     BitPut(b, val, nbits);
 
-    while (b->nbitbuf >= 8)
-    {
-        c = (char) BitGet(b, (long)8);
+    while (b->nbitbuf >= 8) {
+        c = (char) BitGet(b, (long int)8);
 
-        if(putc(c, b->f) == EOF)
-        {
+        if(putc(c, b->f) == EOF) {
             return -1;
         }
         nbyte++;
@@ -205,3 +202,6 @@ pm_bitwrite(b, nbits, val)
 
     return nbyte;
 }
+
+
+
diff --git a/netpbm.c b/netpbm.c
index a9a0bf81..7107d95c 100644
--- a/netpbm.c
+++ b/netpbm.c
@@ -26,6 +26,8 @@
     if (strcmp(cp, s) == 0) exit(m(argc, argv)); \
 }
 
+
+
 int
 main(int argc, char *argv[]) {
 
@@ -34,15 +36,15 @@ main(int argc, char *argv[]) {
     if (strcmp(pm_arg0toprogname(argv[0]), "netpbm") == 0) {
         ++argv;
         --argc;
-        if (argc < 1 || !*argv)	{
+        if (argc < 1 || !*argv) {
             fprintf(stderr,
                     "When you invoke this program by the name 'netpbm', "
                     "You must supply at least one argument: the name of "
                     "the Netpbm program to run, e.g. "
                     "'netpbm pamfile /tmp/myfile.ppm'\n");
             exit(1);
-		}
-	}
+                }
+        }
 
     cp = pm_arg0toprogname(argv[0]);