From 703575d4b45d15996ee2ca0b13d958a22cd78f4f Mon Sep 17 00:00:00 2001 From: Stephane Ouellette Date: Sat, 23 Aug 2003 18:41:47 +0000 Subject: various cosmetic / c99 cleanups (Stephane Ouellette) --- extensions/libip6t_esp.c | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'extensions/libip6t_esp.c') diff --git a/extensions/libip6t_esp.c b/extensions/libip6t_esp.c index 3b471026..29e865d4 100644 --- a/extensions/libip6t_esp.c +++ b/extensions/libip6t_esp.c @@ -19,8 +19,8 @@ IPTABLES_VERSION); } static struct option opts[] = { - { "espspi", 1, 0, '1' }, - {0} + { .name = "espspi", .has_arg = 1, .flag = 0, .val = '1' }, + { .name = 0 } }; static u_int32_t @@ -29,7 +29,7 @@ parse_esp_spi(const char *spistr) unsigned long int spi; char* ep; - spi = strtoul(spistr,&ep,0) ; + spi = strtoul(spistr, &ep, 0); if ( spistr == ep ) { exit_error(PARAMETER_PROBLEM, @@ -117,17 +117,10 @@ print_spis(const char *name, u_int32_t min, u_int32_t max, const char *inv = invert ? "!" : ""; if (min != 0 || max != 0xFFFFFFFF || invert) { - printf("%s", name); - if (min == max) { - printf(":%s", inv); - printf("%u", min); - } else { - printf("s:%s", inv); - printf("%u",min); - printf(":"); - printf("%u",max); - } - printf(" "); + if (min == max) + printf("%s:%s%u ", name, inv, min); + else + printf("%ss:%s%u:%u ", name, inv, min, max); } } @@ -168,19 +161,18 @@ static void save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match } static -struct ip6tables_match esp -= { NULL, - "esp", - IPTABLES_VERSION, - IP6T_ALIGN(sizeof(struct ip6t_esp)), - IP6T_ALIGN(sizeof(struct ip6t_esp)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts +struct ip6tables_match esp = { + .name = "esp", + .version = IPTABLES_VERSION, + .size = IP6T_ALIGN(sizeof(struct ip6t_esp)), + .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_esp)), + .help = &help, + .init = &init, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts }; void -- cgit v1.2.3