From 9edc97da2b75cc3ada86c93ba658d00236b57195 Mon Sep 17 00:00:00 2001
From: Ludovic Pouzenc <ludovic@pouzenc.fr>
Date: Thu, 8 Nov 2012 13:29:33 +0000
Subject: Ajout option -s <snaplen> dans le usage() Ajout d'une condition pour
 compatibilite avec libpcap-0.7 (Debian Etch...)

git-svn-id: file:///var/svn/2012-tzsp/trunk@17 147d2d3d-d0bd-48ea-923a-d90ac20f5906
---
 pcap2tzsp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'pcap2tzsp.c')

diff --git a/pcap2tzsp.c b/pcap2tzsp.c
index 4c1ff03..f508abe 100644
--- a/pcap2tzsp.c
+++ b/pcap2tzsp.c
@@ -79,15 +79,16 @@ static char *opt_snaplen=NULL;
 pcap_t *pcap_handle = NULL;
 
 void usage(char progname[]) {
-	printf("Usage : %s [--verbose] [--brief] [-i <iface>] [-h <host>] [-p <port>] [custom_pcap_filter]\n", progname);
+	printf("Usage : %s [--verbose] [--brief] [-i <iface>] [-h <host>] [-p <port>] [-s <snaplen>] [custom_pcap_filter]\n", progname);
 	printf("\t<iface> : Interface name to capture from (Default : first available interface)\n");
 	printf("\t<host> : Host (or IPv4 address) for sending captured packet headers (Default : '%s')\n", DEFAULT_HOST);
 	printf("\t<port> : Port for sending captured packet headers (Default '%s')\n", DEFAULT_PORT);
+	printf("\t<snaplen> : Snarf  snaplen  bytes  of  data from each packet (Default '%s')\n", DEFAULT_SNAPLEN); 
 	printf("\t<custom_pcap_filter> : libpcap capture filter (Default '%s')\n", DEFAULT_FILTER);
 	exit(1);
 }
 
-
+#ifndef COMPAT_LIBPCAP_0_7
 void sig_handler(int signo) {
 	static int pcap_break=0;
 
@@ -103,6 +104,7 @@ void sig_handler(int signo) {
 			fprintf(stderr, "Catched an unhandled signal : %i\n", signo);
 	}
 }
+#endif
 
 int main(int argc, char *argv[]) {
 
@@ -203,7 +205,9 @@ int main(int argc, char *argv[]) {
     }
 #endif
 
+#ifndef COMPAT_LIBPCAP_0_7
 	signal(SIGINT, sig_handler);
+#endif
 	/* Run the capture loop */
 	start_capture_loop(pcap_filter);
 
-- 
cgit v1.2.3