summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_statistic.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-01-27 18:43:01 +0100
committerJan Engelhardt <jengelh@medozas.de>2009-01-27 23:14:30 +0100
commit5f2922cfc0bbfbeb878f5c12e9fb3eb602ae5507 (patch)
treed0fc6078218d3729279e0d47d3a766fcffdeab9d /extensions/libxt_statistic.c
parent39bf9c8214d3073a496a8a1eff91046a8d6fbbdf (diff)
libxtables: prefix/order - strtoui
This commit also throws out the redundant string_to_number_*. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'extensions/libxt_statistic.c')
-rw-r--r--extensions/libxt_statistic.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/extensions/libxt_statistic.c b/extensions/libxt_statistic.c
index e43de7d2..574f8f7d 100644
--- a/extensions/libxt_statistic.c
+++ b/extensions/libxt_statistic.c
@@ -40,6 +40,7 @@ statistic_parse(int c, char **argv, int invert, unsigned int *flags,
const void *entry, struct xt_entry_match **match)
{
struct xt_statistic_info *info = (void *)(*match)->data;
+ unsigned int val;
double prob;
if (invert)
@@ -70,10 +71,10 @@ statistic_parse(int c, char **argv, int invert, unsigned int *flags,
case '3':
if (*flags & 0x4)
exit_error(PARAMETER_PROBLEM, "double --every");
- if (string_to_number(optarg, 0, UINT32_MAX,
- &info->u.nth.every) == -1)
+ if (!xtables_strtoui(optarg, NULL, &val, 0, UINT32_MAX))
exit_error(PARAMETER_PROBLEM,
"cannot parse --every `%s'", optarg);
+ info->u.nth.every = val;
if (info->u.nth.every == 0)
exit_error(PARAMETER_PROBLEM, "--every cannot be 0");
info->u.nth.every--;
@@ -82,10 +83,10 @@ statistic_parse(int c, char **argv, int invert, unsigned int *flags,
case '4':
if (*flags & 0x8)
exit_error(PARAMETER_PROBLEM, "double --packet");
- if (string_to_number(optarg, 0, UINT32_MAX,
- &info->u.nth.packet) == -1)
+ if (!xtables_strtoui(optarg, NULL, &val, 0, UINT32_MAX))
exit_error(PARAMETER_PROBLEM,
"cannot parse --packet `%s'", optarg);
+ info->u.nth.packet = val;
*flags |= 0x8;
break;
default: