Sync usage with man page.
[netbsd-mini2440.git] / dist / ipf / lib / printproto.c
blobd347497e75d086c6ba6951714f0668b59df819cb
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2005 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
7 */
9 #include "ipf.h"
12 #if !defined(lint)
13 static const char rcsid[] = "@(#)Id: printproto.c,v 1.1.2.3 2007/10/27 16:03:39 darrenr Exp";
14 #endif
17 void printproto(pr, p, np)
18 struct protoent *pr;
19 int p;
20 ipnat_t *np;
22 if (np != NULL) {
23 if ((np->in_flags & IPN_TCPUDP) == IPN_TCPUDP)
24 printf("tcp/udp");
25 else if (np->in_flags & IPN_TCP)
26 printf("tcp");
27 else if (np->in_flags & IPN_UDP)
28 printf("udp");
29 else if (np->in_flags & IPN_ICMPQUERY)
30 printf("icmp");
31 #ifdef _AIX51
33 * To make up for "ip = 252" and "hopopt = 0" in /etc/protocols
34 * The IANA has doubled up on the definition of 0 - it is now
35 * also used for IPv6 hop-opts, so we can no longer rely on
36 * /etc/protocols providing the correct name->number mapping
38 #endif
39 else if (np->in_p == 0)
40 printf("ip");
41 else if (pr != NULL)
42 printf("%s", pr->p_name);
43 else
44 printf("%d", np->in_p);
45 } else {
46 #ifdef _AIX51
47 if (p == 0)
48 printf("ip");
49 else
50 #endif
51 if (pr != NULL)
52 printf("%s", pr->p_name);
53 else
54 printf("%d", p);