about summary refs log tree commit diff
path: root/converter/pgm
diff options
context:
space:
mode:
Diffstat (limited to 'converter/pgm')
-rw-r--r--converter/pgm/Makefile4
-rw-r--r--converter/pgm/asciitopgm.c2
-rw-r--r--converter/pgm/hipstopgm.c2
-rw-r--r--converter/pgm/lispmtopgm.c2
-rw-r--r--converter/pgm/pgmtofs.c6
-rw-r--r--converter/pgm/pgmtolispm.c6
-rw-r--r--converter/pgm/pgmtopgm.c4
-rw-r--r--converter/pgm/rawtopgm.c31
-rw-r--r--converter/pgm/sbigtopgm.c2
9 files changed, 22 insertions, 37 deletions
diff --git a/converter/pgm/Makefile b/converter/pgm/Makefile
index f562fe92..b109683b 100644
--- a/converter/pgm/Makefile
+++ b/converter/pgm/Makefile
@@ -5,7 +5,7 @@ endif
 SUBDIR = converter/pgm
 VPATH=.:$(SRCDIR)/$(SUBDIR)
 
-include $(BUILDDIR)/Makefile.config
+include $(BUILDDIR)/config.mk
 
 PORTBINARIES =	asciitopgm bioradtopgm fstopgm hipstopgm \
 		lispmtopgm pgmtofs pgmtolispm pgmtopgm \
@@ -20,4 +20,4 @@ MERGE_OBJECTS = $(MERGEBINARIES:%=%.o2)
 .PHONY: all
 all: $(BINARIES)
 
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
diff --git a/converter/pgm/asciitopgm.c b/converter/pgm/asciitopgm.c
index 42f6e7db..a3a5bd48 100644
--- a/converter/pgm/asciitopgm.c
+++ b/converter/pgm/asciitopgm.c
@@ -68,7 +68,7 @@ main( argc, argv )
 
     if ( argv[argn][0] == '-' )
     {
-        if ( STREQ( argv[argn], "-d" ) )
+        if ( streq( argv[argn], "-d" ) )
         {
             if ( argc == argn + 1 )
                 pm_usage( usage );
diff --git a/converter/pgm/hipstopgm.c b/converter/pgm/hipstopgm.c
index 826a8511..2f5956e1 100644
--- a/converter/pgm/hipstopgm.c
+++ b/converter/pgm/hipstopgm.c
@@ -98,7 +98,7 @@ read_hips_header( fd, hP )
 	{
         read_line( fd, buf, 5000 );
 	}
-    while ( !STREQ( buf, ".\n" ) );
+    while ( !streq( buf, ".\n" ) );
 }
 
 
diff --git a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c
index 7b98ef00..40dd3fb4 100644
--- a/converter/pgm/lispmtopgm.c
+++ b/converter/pgm/lispmtopgm.c
@@ -89,7 +89,7 @@ getinit( file, colsP, rowsP, depthP, padrightP )
     for ( i = 0; i < sizeof(magic)-1; ++i )
         magic[i] = getc( file );
     magic[i]='\0';
-    if (!STREQ(LISPM_MAGIC, magic))
+    if (!streq(LISPM_MAGIC, magic))
         pm_error( "bad id string in Lispm file" );
     
     if ( pm_readlittleshort( file, colsP ) == -1 )
diff --git a/converter/pgm/pgmtofs.c b/converter/pgm/pgmtofs.c
index b34d77c4..53a2e7b3 100644
--- a/converter/pgm/pgmtofs.c
+++ b/converter/pgm/pgmtofs.c
@@ -128,14 +128,8 @@ putitem( )
     bitshift = 8 - bitspersample;
 }
 
-#if __STDC__
 static void
 putgray( gray g )
-#else /*__STDC__*/
-    static void
-putgray( g )
-    gray g;
-#endif /*__STDC__*/
 {
     if ( bitsperitem == 8 )
         putitem( );
diff --git a/converter/pgm/pgmtolispm.c b/converter/pgm/pgmtolispm.c
index 02f2fd1e..abb85494 100644
--- a/converter/pgm/pgmtolispm.c
+++ b/converter/pgm/pgmtolispm.c
@@ -115,14 +115,8 @@ depth_to_word_size (depth)	/* Lispm architecture specific - if a bitmap is writt
 
 
 
-#if __STDC__
 static void
 putval( gray b )
-#else /*__STDC__*/
-static void
-putval( b )
-gray b;
-#endif /*__STDC__*/
     {
     if ( bitsperitem == 32 )
 	putitem( );
diff --git a/converter/pgm/pgmtopgm.c b/converter/pgm/pgmtopgm.c
index c65e98e0..250bb4dc 100644
--- a/converter/pgm/pgmtopgm.c
+++ b/converter/pgm/pgmtopgm.c
@@ -19,7 +19,7 @@ main(int argc, char *argv[]) {
     int rows, cols;
     gray maxval;
     int row;
-    gray* grayrow;
+    gray * grayrow;
     
     pgm_init(&argc, argv);
     
@@ -32,7 +32,7 @@ main(int argc, char *argv[]) {
 
     grayrow = pgm_allocrow(cols);
 
-    for (row = 0; row < rows; row++) {
+    for (row = 0; row < rows; ++row) {
         pgm_readpgmrow(stdin, grayrow, cols, maxval, format);
         pgm_writepgmrow(stdout, grayrow, cols, maxval, 0);
     }
diff --git a/converter/pgm/rawtopgm.c b/converter/pgm/rawtopgm.c
index c91c6178..0180a02c 100644
--- a/converter/pgm/rawtopgm.c
+++ b/converter/pgm/rawtopgm.c
@@ -11,6 +11,8 @@
 */
 
 #include <math.h>
+
+#include "pm_c_util.h"
 #include "pgm.h"
 #include "shhopt.h"
 
@@ -18,13 +20,13 @@ struct cmdline_info {
     /* All the information the user supplied in the command line,
        in a form easy for the program to use.
     */
-    const char *input_filespec;  /* Filespec of input file */
+    const char * inputFileName;
     unsigned int headerskip;
     float rowskip;
     int bottomfirst;  /* the -bottomfirst/-bt option */
     int autosize;  /* User wants us to figure out the size */
-    int width;
-    int height;
+    unsigned int width;
+    unsigned int height;
     int bpp;
       /* bytes per pixel in input format.  1 or 2 */
     int littleendian;
@@ -74,21 +76,21 @@ parse_command_line(int argc, char ** argv,
         /* Uses and sets argc, argv, and some of *cmdline_p and others. */
 
     if (argc-1 == 0) {
-        cmdline_p->input_filespec = "-";
+        cmdline_p->inputFileName = "-";
         cmdline_p->autosize = TRUE;
     } else if (argc-1 == 1) {
-        cmdline_p->input_filespec = argv[1];
+        cmdline_p->inputFileName = argv[1];
         cmdline_p->autosize = TRUE;
     } else if (argc-1 == 2) {
-        cmdline_p->input_filespec = "-";
+        cmdline_p->inputFileName = "-";
         cmdline_p->autosize = FALSE;
-        cmdline_p->width = atoi(argv[1]);
-        cmdline_p->height = atoi(argv[2]);
+        cmdline_p->width = pm_parse_width(argv[1]);
+        cmdline_p->height = pm_parse_height(argv[2]);
     } else if (argc-1 == 3) {
-        cmdline_p->input_filespec = argv[3];
+        cmdline_p->inputFileName = argv[3];
         cmdline_p->autosize = FALSE;
-        cmdline_p->width = atoi(argv[1]);
-        cmdline_p->height = atoi(argv[2]);
+        cmdline_p->width = pm_parse_width(argv[1]);
+        cmdline_p->height = pm_parse_height(argv[2]);
     } else
         pm_error("Program takes zero, one, two, or three arguments.  You "
                  "specified %d", argc-1);
@@ -107,11 +109,6 @@ parse_command_line(int argc, char ** argv,
         pm_error("Maxval must be less than 65536.  You specified %d.",
                  cmdline_p->maxval);
 
-    if (cmdline_p->width <= 0) 
-        pm_error("Width must be a positive number.");
-    if (cmdline_p->height <= 0) 
-        pm_error("Height must be a positive number.");
-
     if (cmdline_p->rowskip && cmdline_p->autosize)
         pm_error("If you specify -rowskip, you must also give the image "
                  "dimensions.");
@@ -221,7 +218,7 @@ main(int argc, char *argv[] ) {
 
     parse_command_line(argc, argv, &cmdline);
 
-    ifp = pm_openr(cmdline.input_filespec);
+    ifp = pm_openr(cmdline.inputFileName);
 
     if (cmdline.autosize || cmdline.bottomfirst) {
         buf = pm_read_unknown_size( ifp, &nread );
diff --git a/converter/pgm/sbigtopgm.c b/converter/pgm/sbigtopgm.c
index 228b71b3..dd4e921a 100644
--- a/converter/pgm/sbigtopgm.c
+++ b/converter/pgm/sbigtopgm.c
@@ -142,7 +142,7 @@ int main(argc, argv)
 	    cols = atoi(hdr + 6);
         } else if (strncmp(hdr, "sat_level=", 10) == 0) {
 	    maxval = atoi(hdr + 10);
-        } else if (STREQ(hdr, "end")) {
+        } else if (streq(hdr, "end")) {
 	    break;
 	}
 	hdr = cp + 1;