|
From: <kin...@us...> - 2025-09-30 19:47:03
|
Revision: 7550
http://sourceforge.net/p/teem/code/7550
Author: kindlmann
Date: 2025-09-30 19:47:02 +0000 (Tue, 30 Sep 2025)
Log Message:
-----------
oops long comment belongs outside if verbose check
Modified Paths:
--------------
teem/trunk/src/hest/parsest.c
Modified: teem/trunk/src/hest/parsest.c
===================================================================
--- teem/trunk/src/hest/parsest.c 2025-09-30 19:24:02 UTC (rev 7549)
+++ teem/trunk/src/hest/parsest.c 2025-09-30 19:47:02 UTC (rev 7550)
@@ -1385,17 +1385,17 @@
&& !strcmp("", hopt[opi].havec->harg[0]->str) //
&& hestSourceDefault == hopt[opi].source //
&& 0 == hopt[opi].min) {
+ /* An established hest idiom (certainly used by unu, e.g. unu resample -off)
+ for non-string-type variadic options with min=0, is to give a default as the
+ "" empty string to mean: 0 values. In the old (pre-2025) code based on
+ strtok: strtok would look at "" and see zero tokens and say: 0 values. The
+ new code sees "" as one arg, dutifully saved to the per-option havec, and
+ then we would (below) try to parse "" as some type (e.g. double), which isn't
+ intended. So here is where we make the idiom work again: if the per-option
+ havec is just a single empty string that came from the default, and this is a
+ non-string variadic option with min=0, then we pretend like we never saw any
+ args, and reset per-option havec to length 0. */
if (hparm->verbosity) {
- /* An established hest idiom (certainly used by unu, e.g. unu resample -off)
- for non-string-type variadic options with min=0, is to give a default as the
- "" empty string to mean: 0 values. In the old (pre-2025) code based on
- strtok: strtok would look at "" and see zero tokens and say: 0 values. The
- new code sees "" as one arg, dutifully saved to the per-option havec, and
- then we would (below) try to parse "" as some type (e.g. double), which isn't
- intended. So here is where we make the idiom work again: if the per-option
- havec is just a single empty string that came from the default, and this is a
- non-string variadic option with min=0, then we pretend like we never saw any
- args, and reset per-option havec to length 0. */
printf(
"%s: (kind 5) %s[%u] (type=%s min=0) default single arg==empty-string "
"treated as 0 args\n",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|