## Bugfixes and other changes
+- Allow decimal numbers for '-t', '-i', '-p', and '-Q'
- Fix build with --disable-ipv6 (#134, thanks @Polynomial-C)
- Fix hang with '-6', with ipv6 kernel module, but not loaded (#140, thanks @abelbeck)
- Assume '-6' if the binary is named 'fping6' (this is mostly for special
{ 0, 0, 0 }
};
- //while ((c = optparse(&optparse_state, "46ADMNRadeghlmnoqsuvzB:C:H:I:O:Q:S:T:b:c:f:i:p:r:t:")) != EOF) {
+ float opt_value_float;
while ((c = optparse_long(&optparse_state, longopts, NULL)) != EOF) {
switch (c) {
case '4':
break;
case 't':
- if (!(timeout = (unsigned int)atoi(optparse_state.optarg) * 100))
+ if (!sscanf(optparse_state.optarg, "%f", &opt_value_float))
usage(1);
+ if (opt_value_float < 0) {
+ usage(1);
+ }
+ timeout = opt_value_float * 100;
timeout_flag = 1;
-
break;
case 'r':
break;
case 'i':
- if (!sscanf(optparse_state.optarg, "%u", &interval))
+ if (!sscanf(optparse_state.optarg, "%f", &opt_value_float))
usage(1);
- interval *= 100;
+ if (opt_value_float < 0) {
+ usage(1);
+ }
+ interval = opt_value_float * 100;
break;
case 'p':
- if (!(perhost_interval = (unsigned int)atoi(optparse_state.optarg) * 100))
+ if (!sscanf(optparse_state.optarg, "%f", &opt_value_float))
usage(1);
+ if (opt_value_float < 0) {
+ usage(1);
+ }
+ perhost_interval = opt_value_float * 100;
break;
case 'Q':
verbose_flag = 0;
quiet_flag = 1;
- if (!(report_interval = (unsigned int)atoi(optparse_state.optarg) * 100000))
+ if (!sscanf(optparse_state.optarg, "%f", &opt_value_float))
usage(1);
+ if (opt_value_float < 0) {
+ usage(1);
+ }
+ report_interval = opt_value_float * 100000;
break;