ongrep

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

commit 3523f46f842c9ae24d8a96fbb5ddf6aa90c9e91f
parent edb557f0fcc132d806233d8d5974fddfac307fb7
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Mon, 29 Dec 2003 01:36:47 +0000

changed minor behaviourism of ``-q'' (quiet).  previously when
outputting to a pcap_dump file, -q would omit even printing the packet
dump to the console altogether (Whereas the normal behaviour is simply
to omit printing ``#'' marks).  now the behaviour between normal and
pcap_dump file usage is identical, and specifying a second ``-q'' on
the command-line will omit the console display of the payload
regardless of mode.

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

diff --git a/ngrep.c b/ngrep.c @@ -557,10 +557,11 @@ void process(u_char *data1, struct pcap_pkthdr* h, u_char *p) { frag_offset, len); else printf("\n"); - if (pd_dump) { + if (pd_dump) pcap_dump((u_char*)pd_dump, h, p); - if (!quiet) dump_func(data, len); - } else dump_func(data, len); + + if (quiet < 2) + dump_func(data, len); } } break; @@ -610,10 +611,11 @@ void process(u_char *data1, struct pcap_pkthdr* h, u_char *p) { frag_offset, len); else printf("\n"); - if (pd_dump) { + if (pd_dump) pcap_dump((u_char*)pd_dump, h, p); - if (!quiet) dump_func(data, len); - } else dump_func(data, len); + + if (quiet < 2) + dump_func(data, len); } } break; @@ -656,10 +658,11 @@ void process(u_char *data1, struct pcap_pkthdr* h, u_char *p) { frag_offset, len); else printf("\n"); - if (pd_dump) { + if (pd_dump) pcap_dump((u_char*)pd_dump, h, p); - if (!quiet) dump_func(data, len); - } else dump_func(data, len); + + if (quiet < 2) + dump_func(data, len); } } break;