Commit 20e14e13 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

ioping: allow fractional values in arguments

example: -s 3/4m -- 768k, -i 1/10s -- 10 iops
Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 27de1158
......@@ -401,9 +401,17 @@ long long parse_suffix(const char *str, struct suffix *sfx,
long long min, long long max)
{
char *end;
double val;
double val, den;
val = strtod(str, &end);
if (*end == '/') {
if (end == str)
val = 1;
den = strtod(end + 1, &end);
if (!den)
errx(1, "division by zero in parsing argument: %s", str);
val /= den;
}
for ( ; sfx->txt ; sfx++ ) {
if (strcasecmp(end, sfx->txt))
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment