xref: /netbsd-src/external/bsd/ipf/dist/lib/printtcpflags.c (revision bc4097aacfdd9307c19b7947c13c6ad6982527a9)
1 /*	$NetBSD: printtcpflags.c,v 1.1.1.1 2012/03/23 21:20:10 christos Exp $	*/
2 
3 #include "ipf.h"
4 
5 
6 void
printtcpflags(tcpf,tcpfm)7 printtcpflags(tcpf, tcpfm)
8 	u_32_t tcpf, tcpfm;
9 {
10 	u_char *t;
11 	char *s;
12 
13 	if (tcpf & ~TCPF_ALL) {
14 		PRINTF("0x%x", tcpf);
15 	} else {
16 		for (s = flagset, t = flags; *s; s++, t++) {
17 			if (tcpf & *t)
18 				(void)putchar(*s);
19 		}
20 	}
21 
22 	if (tcpfm) {
23 		(void)putchar('/');
24 		if (tcpfm & ~TCPF_ALL) {
25 			PRINTF("0x%x", tcpfm);
26 		} else {
27 			for (s = flagset, t = flags; *s; s++, t++)
28 				if (tcpfm & *t)
29 					(void)putchar(*s);
30 		}
31 	}
32 }
33