about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY4
-rw-r--r--lib/libpam.c21
2 files changed, 22 insertions, 3 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 4edce4fc..0a7d7d98 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -18,6 +18,10 @@ not yet  BJH  Release 10.63.00
               411toppm: check for inconsistencies between specified
               width and height and size of input.
 
+              Ignore -plain when program generates PAM.  Before, programs
+              failed if the user specified -plain to a program that generates
+              a PAM image.
+
               giftopnm: fix bug: erroneously claims GIF ends prematurely.
               Broken in Netpbm 10.38 (March 2007).  This affects all GIFs, but
               the problem does not manifest when Netpbm was built with Gcc
diff --git a/lib/libpam.c b/lib/libpam.c
index c99ebd54..f188f7d6 100644
--- a/lib/libpam.c
+++ b/lib/libpam.c
@@ -1046,9 +1046,7 @@ pnm_writepaminit(struct pam * const pamP) {
     
     switch (PAM_FORMAT_TYPE(pamP->format)) {
     case PAM_TYPE:
-        if (pm_plain_output)
-            pm_error("There is no plain version of PAM.  -plain option "
-                     "is not allowed");
+        /* See explanation below of why we ignore 'pm_plain_output' here. */
         fprintf(pamP->file, "P7\n");
         writeComments(pamP);
         fprintf(pamP->file, "WIDTH %u\n",   (unsigned)pamP->width);
@@ -1108,6 +1106,23 @@ pnm_writepaminit(struct pam * const pamP) {
 
 
 
+/* EFFECT OF -plain WHEN WRITING PAM FORMAT:
+
+   Before Netpbm 10.63 (June 2013), pnm_writepaminit() did a pm_error() here
+   if 'pm_plain_output' was set (i.e. the user said -plain).  But this isn't
+   really logical, because -plain is a global option for the program and here
+   we are just writing one image.  As a global option, -plain must be defined
+   to have effect where it makes sense and have no effect where it doesn't.
+   Note that a program that generates GIF just ignores -plain.  Note also that
+   a program could conceivably generate both a PPM image and a PAM image.
+
+   Note also how we handle the other a user can request plain format: the
+   'plainformat' member of the PAM struct.  In the case of PAM, we ignore that
+   member.
+*/
+
+
+
 void
 pnm_checkpam(const struct pam *   const pamP, 
              enum pm_check_type   const checkType,