about summary refs log tree commit diff
path: root/converter/ppm/pjtoppm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-06 03:38:03 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-06-06 03:38:03 +0000
commit4afa7625fa0819457809a2d54d99ef5ee5ed34e0 (patch)
tree715572e68e1124c86ca6c785db732a57f6361931 /converter/ppm/pjtoppm.c
parentf6e2923059aa9c4e8bbb4fbdde2baa3ea55f645d (diff)
downloadnetpbm-mirror-4afa7625fa0819457809a2d54d99ef5ee5ed34e0.tar.gz
netpbm-mirror-4afa7625fa0819457809a2d54d99ef5ee5ed34e0.tar.xz
netpbm-mirror-4afa7625fa0819457809a2d54d99ef5ee5ed34e0.zip
Release 10.86.14
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3831 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/pjtoppm.c')
-rw-r--r--converter/ppm/pjtoppm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/converter/ppm/pjtoppm.c b/converter/ppm/pjtoppm.c
index b8b94f74..cd558855 100644
--- a/converter/ppm/pjtoppm.c
+++ b/converter/ppm/pjtoppm.c
@@ -10,6 +10,8 @@
 ** implied warranty.
 */
 
+#include <stdbool.h>
+
 #include "ppm.h"
 #include "pm_c_util.h"
 #include "mallocvar.h"
@@ -54,6 +56,7 @@ main(int argc, const char ** argv) {
     int *imlen;
     FILE * ifP;
     int mode;
+    bool modeIsSet;
     int argn;
     unsigned char bf[3];
     pixel * pixrow;
@@ -74,6 +77,7 @@ main(int argc, const char ** argv) {
 
     row = 0;  /* initial value */
     plane = 0;  /* initial value */
+    modeIsSet = false;  /* initial value */
 
     while ((c = fgetc(ifP)) != -1) {
         if (c != '\033')
@@ -145,6 +149,7 @@ main(int argc, const char ** argv) {
                     if (val != 0 && val != 1)
                         pm_error("unimplemented trasmission mode %d", val);
                     mode = val;
+                    modeIsSet = true;
                     break;
                 case 'V':   /* send plane */
                 case 'W':   /* send last plane */
@@ -214,6 +219,10 @@ main(int argc, const char ** argv) {
         } /* switch */
     }
     pm_close(ifP);
+
+    if (!modeIsSet)
+        pm_error("Input does not contain a 'bM' transmission mode order");
+
     rows = row;
     if (mode == 1) {
         int const newcols = 10240;  /* It could not be larger that that! */