| 117 | char *end = NULL; |
| 118 | double v = strtod(s, &end); |
| 119 | if (s[0] == '\0' || *end != '\0' || !isfinite(v)) { |
| 120 | fprintf(stderr, "ds4-bench: invalid value for %s: %s\n", opt, s); |
| 121 | exit(2); |
| 122 | } |
| 123 | return v; |
| 124 | } |
| 125 | |
| 126 | static const char *need_arg(int *i, int argc, char **argv, const char *opt) { |
| 127 | if (*i + 1 >= argc) { |
| 128 | fprintf(stderr, "ds4-bench: %s requires an argument\n", opt); |
| 129 | exit(2); |
| 130 | } |