about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-11-05 20:39:05 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2020-11-05 20:39:05 +0000
commita16ccc11c0f28ec2e93515507ba6d68d62942f03 (patch)
tree1d591ec940335927031d726cf86080c9907c751d
parent1a6b1b3b5fe92754ae2b6d66121638bcbddbbe2d (diff)
downloadnetpbm-mirror-a16ccc11c0f28ec2e93515507ba6d68d62942f03.tar.gz
netpbm-mirror-a16ccc11c0f28ec2e93515507ba6d68d62942f03.tar.xz
netpbm-mirror-a16ccc11c0f28ec2e93515507ba6d68d62942f03.zip
Make -closeness floating point
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3983 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--other/pamarith.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/other/pamarith.c b/other/pamarith.c
index 858acf3f..d2544d6d 100644
--- a/other/pamarith.c
+++ b/other/pamarith.c
@@ -84,7 +84,7 @@ parseCommandLine(int argc, const char ** const argv,
         andSpec, orSpec, nandSpec, norSpec, xorSpec,
         shiftleftSpec, shiftrightSpec, closenessSpec;
 
-    unsigned int closeness;
+    float closeness;
 
     MALLOCARRAY_NOFAIL(option_def, 100);
 
@@ -106,7 +106,7 @@ parseCommandLine(int argc, const char ** const argv,
     OPTENT3(0, "xor",         OPT_FLAG,   NULL, &xorSpec,        0);
     OPTENT3(0, "shiftleft",   OPT_FLAG,   NULL, &shiftleftSpec,  0);
     OPTENT3(0, "shiftright",  OPT_FLAG,   NULL, &shiftrightSpec, 0);
-    OPTENT3(0, "closeness",   OPT_UINT,   &closeness, &closenessSpec, 0);
+    OPTENT3(0, "closeness",   OPT_FLOAT,  &closeness, &closenessSpec, 0);
 
     opt.opt_table = option_def;
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
@@ -162,8 +162,8 @@ parseCommandLine(int argc, const char ** const argv,
         if (cmdlineP->function != FN_EQUAL)
             pm_error("-closeness is valid only with -equal");
         else {
-            if (closeness > 100)
-                pm_error("-closeness value %u is not a valid percentage",
+            if (closeness < 0 || closeness > 100)
+                pm_error("-closeness value %f is not a valid percentage",
                          closeness);
             cmdlineP->closeness = (double)closeness/100;
         }