summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-04-06 15:49:44 -0700
committerBart Van Assche <bart.vanassche@wdc.com>2018-04-06 15:54:08 -0700
commita1e070c87536ad8803c04bcb60660a3ab649763d (patch)
tree7736b085ba643daada6069a692591b2113fd333c /parse.c
parent2b8b8f0dccb4c7e97aee3b7d7e13d8528467d64e (diff)
downloadfio-a1e070c87536ad8803c04bcb60660a3ab649763d.tar.gz
fio-a1e070c87536ad8803c04bcb60660a3ab649763d.tar.bz2
Fix floating point option range formatting
Ensure that floating point option ranges are properly formatted if only one of the two boundaries is specified. A few examples of how option ranges are formatted with this patch applied: range: max=100.000000 range: min=0.000000, max=100.000000 range: min=0.000000 Reported-by: Sitsofe Wheeler <sitsofe@gmail.com> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/parse.c b/parse.c
index deb4120f..39934711 100644
--- a/parse.c
+++ b/parse.c
@@ -71,13 +71,17 @@ static void show_option_range(const struct fio_option *o,
size_t (*logger)(const char *format, ...))
{
if (o->type == FIO_OPT_FLOAT_LIST) {
+ const char *sep = "";
if (!o->minfp && !o->maxfp)
return;
- if (o->minfp != DBL_MIN)
- logger("%20s: min=%f", "range", o->minfp);
+ logger("%20s: ", "range");
+ if (o->minfp != DBL_MIN) {
+ logger("min=%f", o->minfp);
+ sep = ", ";
+ }
if (o->maxfp != DBL_MAX)
- logger(", max=%f", o->maxfp);
+ logger("%smax=%f", sep, o->maxfp);
logger("\n");
} else if (!o->posval[0].ival) {
if (!o->minval && !o->maxval)