commit 6a1c8bfa5f29e9f9ecf851d00f1a0210dac325bf
parent 75d269fb6d9921f0090d9ec5ddf7880d25fd0247
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 13 Jan 2021 15:33:56 +0100
rangetest: match @VAL@ string in cmd
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/rangetest b/rangetest
@@ -1,9 +1,9 @@
#!/usr/bin/awk -f
# uses a binary search to run a "cmd" where the first occurence of
-# string @PARAM@ is substituted for a value between "min_val" and
-# max_val". Successful runs are reported on stdout, failed runs on
-# stderr. The "cmd" command must successfully run with either "min_val"
-# or "max_val".
+# string @VAL@ is substituted for a value between "min_val" and
+# "max_val". Successful runs are reported on stdout, failed runs
+# on stderr. The "cmd" command must successfully run with either
+# "min_val" or "max_val".
function die(s) {
printf "error: %s\n", s > "/dev/stderr"
@@ -11,7 +11,7 @@ function die(s) {
}
function launch(cmd, val) {
- sub(/@PARAM@/, val, cmd)
+ sub(/@VAL@/, val, cmd)
if (system(cmd)) {
printf "%g\n", val > "/dev/stderr"
return 1
@@ -65,8 +65,8 @@ BEGIN {
min = ARGV[2]
max = ARGV[3]
- if (!match(cmd, /@PARAM@/))
- die("@PARAM@ not found in cmd")
+ if (!match(cmd, /@VAL@/))
+ die("@VAL@ not found in cmd")
if (min >= max)
die("min_val must be smaller than max_val")