about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-11-14 19:52:57 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-11-14 19:52:57 +0000
commitcd55cb529c43d0772fb0daf64af0bac465910260 (patch)
tree2ef6b6e32ae4b2fd642c1a3f3f22f9a9fc24568c
parent40110fe7a292a322cfa033bb59638a2822436811 (diff)
downloadnetpbm-mirror-cd55cb529c43d0772fb0daf64af0bac465910260.tar.gz
netpbm-mirror-cd55cb529c43d0772fb0daf64af0bac465910260.tar.xz
netpbm-mirror-cd55cb529c43d0772fb0daf64af0bac465910260.zip
Mark equal and mean as dyadic, since they are not associative
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3986 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--other/pamarith.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/other/pamarith.c b/other/pamarith.c
index 4220169d..a4cb3502 100644
--- a/other/pamarith.c
+++ b/other/pamarith.c
@@ -29,8 +29,6 @@ isDyadic(enum Function const function) {
     case FN_MULTIPLY:
     case FN_MINIMUM:
     case FN_MAXIMUM:
-    case FN_MEAN:
-    case FN_EQUAL:
     case FN_AND:
     case FN_NAND:
     case FN_OR:
@@ -42,8 +40,10 @@ isDyadic(enum Function const function) {
     case FN_DIFFERENCE:
     case FN_COMPARE:
     case FN_DIVIDE:
+    case FN_MEAN:
     case FN_SHIFTLEFT:
     case FN_SHIFTRIGHT:
+    case FN_EQUAL:
         retval = TRUE;
         break;
     }
@@ -176,9 +176,11 @@ parseCommandLine(int argc, const char ** const argv,
                  argc-1);
     else {
         if (isDyadic(cmdlineP->function) && argc-1 > 2)
-            pm_error("You specified %u arguments, but a dyadic function.  "
-                     "For a dyadic function, you must specify 2 arguments:  "
-                     "the operands of the function", argc-1);
+            pm_error("You specified %u arguments, but a function "
+                     "which is not associative and commutative.  "
+                     "Unless a function is associative and commutative "
+                     "(like -add), you must specify exactly two arguments. ",
+                     argc-1);
         else {
             cmdlineP->operandCt = argc-1;
             cmdlineP->operandFileNames = &argv[1];