ongrep

A cleaned up fork of ngrep for OpenBSD
git clone git://git.sgregoratto.me/ongrep
Log | Files | Refs | README | LICENSE

commit 8ece06aa62a9566a7c06fa09c66db6c684240090
parent 6dd76723539c0c05075912498afdc9f65f13d0ef
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Wed,  4 May 2005 18:48:08 +0000

move netident_t stuff inside braces because this is C, can't just alloc
vars anywhere

Diffstat:
Mngrep.c | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/ngrep.c b/ngrep.c @@ -821,19 +821,21 @@ void dump_packet(struct pcap_pkthdr *h, u_char *p, uint8_t proto, unsigned char if (!live_read && want_delay) dump_delay(h); - netident_t ident; + { + char ident; + + switch (proto) { + case IPPROTO_TCP: ident = TCP; break; + case IPPROTO_UDP: ident = UDP; break; + case IPPROTO_ICMP: ident = ICMP; break; + case IPPROTO_ICMPV6: ident = ICMPv6; break; + case IPPROTO_IGMP: ident = IGMP; break; + default: ident = UNKNOWN; break; + } - switch (proto) { - case IPPROTO_TCP: ident = TCP; break; - case IPPROTO_UDP: ident = UDP; break; - case IPPROTO_ICMP: ident = ICMP; break; - case IPPROTO_ICMPV6: ident = ICMPv6; break; - case IPPROTO_IGMP: ident = IGMP; break; - default: ident = UNKNOWN; break; + printf("\n%c", ident); } - printf("\n%c", ident); - if (show_proto) printf("(%u)", proto);