From cea9f71f5618250a38acb21c31fbbf93a752f7d4 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 9 Dec 2008 15:06:20 +0100 Subject: iptables-save: output ! in position according to manpage Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- extensions/libxt_length.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'extensions/libxt_length.c') diff --git a/extensions/libxt_length.c b/extensions/libxt_length.c index c5c411e1..98e81673 100644 --- a/extensions/libxt_length.c +++ b/extensions/libxt_length.c @@ -91,28 +91,26 @@ static void length_check(unsigned int flags) } static void -print_length(struct xt_length_info *info) +length_print(const void *ip, const struct xt_entry_match *match, int numeric) { - if (info->invert) - printf("! "); - - if (info->max == info->min) + const struct xt_length_info *info = (void *)match->data; + + printf("length %s", info->invert ? "!" : ""); + if (info->min == info->max) printf("%u ", info->min); else printf("%u:%u ", info->min, info->max); } -static void -length_print(const void *ip, const struct xt_entry_match *match, int numeric) -{ - printf("length "); - print_length((struct xt_length_info *)match->data); -} - static void length_save(const void *ip, const struct xt_entry_match *match) { - printf("--length "); - print_length((struct xt_length_info *)match->data); + const struct xt_length_info *info = (void *)match->data; + + printf("%s--length ", info->invert ? "! " : ""); + if (info->min == info->max) + printf("%u ", info->min); + else + printf("%u:%u ", info->min, info->max); } static struct xtables_match length_match = { -- cgit v1.2.3