about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-09-01 02:27:23 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2007-09-01 02:27:23 +0000
commit51eb8e3c03a14d10c5e9253992af32f9c1144203 (patch)
tree6d1800650d3e74a5d962a997d8a4c5c1f9cfc57c
parent59d07fdcf4e40587fc7b23fef7d5a1559dc37eef (diff)
downloadnetpbm-mirror-51eb8e3c03a14d10c5e9253992af32f9c1144203.tar.gz
netpbm-mirror-51eb8e3c03a14d10c5e9253992af32f9c1144203.tar.xz
netpbm-mirror-51eb8e3c03a14d10c5e9253992af32f9c1144203.zip
Use Standard Input properly
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@395 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY24
-rw-r--r--other/pamstack.c16
2 files changed, 25 insertions, 15 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index f93c3c87..69b5e952 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,18 +6,9 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.40.00
 
-              libnetpbm: pbm_readppminit: read PBM as maxval of 255, not 1.
-
               pbmtonokia: fail if input is > 255 x 255.  Thanks Paul Bolle
               <pebolle@tiscali.nl>.
 
-              pnmtopalm: fix typo in error message.  Thanks Paul Bolle
-              <pebolle@tiscali.nl>.
-
-              pnmtops: fix crash when program attempts to write 12 bits per
-              sample Postscript.  It doesn't really know how to do that, so
-              now it just writes 8 unless you do -psfilter.
-
               pamfunc: Add -andmask, -ormask, -xormask, -not,
               -shiftleft, -shiftright.
 
@@ -27,6 +18,17 @@ not yet  BJH  Release 10.40.00
               pnmmargin: add -plain option.    Thanks
               Prophet of the Way <afu@wta.att.ne.jp>.
 
+              pnmgamma: improve error messages.
+
+              pamstack: accept Standard Input properly.
+
+              pnmtopalm: fix typo in error message.  Thanks Paul Bolle
+              <pebolle@tiscali.nl>.
+
+              pnmtops: fix crash when program attempts to write 12 bits per
+              sample Postscript.  It doesn't really know how to do that, so
+              now it just writes 8 unless you do -psfilter.
+
               pnmmargin: recognize invalid options better.    Thanks
               Prophet of the Way <afu@wta.att.ne.jp>.
 
@@ -36,12 +38,12 @@ not yet  BJH  Release 10.40.00
 
               pnmtopng: Fix array bound violation with > 256 alpha mask levels.
 
-              pnmgamma: improve error messages.
-
               pamtopfm: Fix wrong selection of default endianness.
 
               libnetpbm: Add pm_system_lp(), pm_system_vp().
 
+              libnetpbm: pbm_readppminit: read PBM as maxval of 255, not 1.
+
               libnetpbm: Fix uninitialized variable in pnm_allocpamrown().
 
               Rename pamtooctave to pamtooctaveimg.
diff --git a/other/pamstack.c b/other/pamstack.c
index 4f8d9945..d9691f74 100644
--- a/other/pamstack.c
+++ b/other/pamstack.c
@@ -15,6 +15,7 @@
 #include <string.h>
 
 #include "mallocvar.h"
+#include "nstring.h"
 #include "shhopt.h"
 #include "pam.h"
 
@@ -72,16 +73,23 @@ parseCommandLine(int argc, char ** argv,
 
     cmdlineP->nInput = 0;  /* initial value */
     { 
-        int argn;
-        for (argn = 1; argn < argc; argn++) {
+        unsigned int argn;
+        bool stdinUsed;
+        for (argn = 1, stdinUsed = false; argn < argc; ++argn) {
             if (cmdlineP->nInput >= MAX_INPUTS) 
-                pm_error("You may not specify more than %d input images.",
+                pm_error("You may not specify more than %u input images.",
                          MAX_INPUTS);
             cmdlineP->inputFileName[cmdlineP->nInput++] = argv[argn];
+            if (streq(argv[argn], "-")) {
+                if (stdinUsed)
+                    pm_error("You cannot specify Standard Input ('-') "
+                             "for more than one input file");
+                stdinUsed = true;
+            }
         }
     }
     if (cmdlineP->nInput < 1)
-        pm_error("You must specify at least one input PAM image.");
+        cmdlineP->inputFileName[cmdlineP->nInput++] = "-";
 }