From: Bart Van Assche Date: Fri, 6 Apr 2018 22:49:44 +0000 (-0700) Subject: Fix floating point option range formatting X-Git-Tag: fio-3.6~16^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a1e070c87536ad8803c04bcb60660a3ab649763d;hp=2b8b8f0dccb4c7e97aee3b7d7e13d8528467d64e 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 Signed-off-by: Bart Van Assche --- 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)