From 51eb8e3c03a14d10c5e9253992af32f9c1144203 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 1 Sep 2007 02:27:23 +0000 Subject: Use Standard Input properly git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@395 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- doc/HISTORY | 24 +++++++++++++----------- other/pamstack.c | 16 ++++++++++++---- 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 . - pnmtopalm: fix typo in error message. Thanks Paul Bolle - . - - 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 . + pnmgamma: improve error messages. + + pamstack: accept Standard Input properly. + + pnmtopalm: fix typo in error message. Thanks Paul Bolle + . + + 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 . @@ -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 #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++] = "-"; } -- cgit 1.4.1