1 struct xt_icmp_names { 2 const char *name; 3 uint8_t type; 4 uint8_t code_min, code_max; 5 }; 6 xt_print_icmp_types(const struct xt_icmp_names * icmp_codes,unsigned int n_codes)7static void xt_print_icmp_types(const struct xt_icmp_names *icmp_codes, 8 unsigned int n_codes) 9 { 10 unsigned int i; 11 12 for (i = 0; i < n_codes; ++i) { 13 if (i && icmp_codes[i].type == icmp_codes[i-1].type) { 14 if (icmp_codes[i].code_min == icmp_codes[i-1].code_min 15 && (icmp_codes[i].code_max 16 == icmp_codes[i-1].code_max)) 17 printf(" (%s)", icmp_codes[i].name); 18 else 19 printf("\n %s", icmp_codes[i].name); 20 } 21 else 22 printf("\n%s", icmp_codes[i].name); 23 } 24 printf("\n"); 25 } 26