Ethereal-users: [Ethereal-users] tiny patch for ethereal-0.10.9

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Yoshihiro Oyama <y.oyama@xxxxxxxxxxxxxx>
Date: Fri, 28 Jan 2005 04:42:00 +0900
 * fix: link error of plugins/irda/packet-irda.o 
     with --enable-static

 * fix: compile error of plugins/mate/mate.h 
     with  -D_U_="__attribute__((unused))"

 * add: "tethereal -r '-' < some packet file"

diff -ru ethereal-0.10.9/Makefile.am ethereal-0.10.9custom/Makefile.am
--- ethereal-0.10.9/Makefile.am	Tue Jan 18 11:39:12 2005
+++ ethereal-0.10.9custom/Makefile.am	Fri Jan 28 09:12:16 2005
@@ -146,7 +146,7 @@
 	plugins/giop/packet-cosnaming.o \
 	plugins/giop/packet-coseventcomm.o \
 	plugins/gryphon/packet-gryphon.o \
-	plugins/irda/packet-irda.o \
+	plugins/irda/packet-irda.o plugins/irda/packet-ircomm.o plugins/irda/packet-sir.o \
 	plugins/lwres/packet-lwres.o \
 	plugins/megaco/packet-megaco.o \
 	plugins/mgcp/packet-mgcp.o \
diff -ru ethereal-0.10.9/Makefile.in ethereal-0.10.9custom/Makefile.in
--- ethereal-0.10.9/Makefile.in	Fri Jan 21 04:45:51 2005
+++ ethereal-0.10.9custom/Makefile.in	Fri Jan 28 09:13:09 2005
@@ -196,7 +196,7 @@
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/giop/packet-cosnaming.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/giop/packet-coseventcomm.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/gryphon/packet-gryphon.o \
-@ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/irda/packet-irda.o \
+@ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/irda/packet-irda.o plugins/irda/packet-ircomm.o plugins/irda/packet-sir.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/lwres/packet-lwres.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/megaco/packet-megaco.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/mgcp/packet-mgcp.o \
@@ -829,7 +829,7 @@
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/giop/packet-cosnaming.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/giop/packet-coseventcomm.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/gryphon/packet-gryphon.o \
-@ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/irda/packet-irda.o \
+@ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/irda/packet-irda.o plugins/irda/packet-ircomm.o plugins/irda/packet-sir.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/lwres/packet-lwres.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/megaco/packet-megaco.o \
 @ENABLE_STATIC_TRUE@@HAVE_PLUGINS_TRUE@	plugins/mgcp/packet-mgcp.o \
diff -ru ethereal-0.10.9/plugins/mate/mate.h ethereal-0.10.9custom/plugins/mate/mate.h
--- ethereal-0.10.9/plugins/mate/mate.h	Tue Jan 18 11:39:21 2005
+++ ethereal-0.10.9custom/plugins/mate/mate.h	Fri Jan 28 08:48:43 2005
@@ -324,7 +324,7 @@
 extern void initialize_mate_runtime(void);
 extern mate_pdu* mate_get_pdus(guint32 framenum);
 extern void mate_analyze_frame(packet_info *pinfo, proto_tree* tree);
-extern int mate_packet(void* _U_, packet_info* _U_, epan_dissect_t* _U_,const void* _U_);
+extern int mate_packet(void* , packet_info* , epan_dissect_t* ,const void* );
 
 /* from mate_setup.c */
 extern mate_config* mate_make_config(guint8* filename);
diff -ru ethereal-0.10.9/wiretap/file_access.c ethereal-0.10.9custom/wiretap/file_access.c
--- ethereal-0.10.9/wiretap/file_access.c	Tue Jan 18 11:40:03 2005
+++ ethereal-0.10.9custom/wiretap/file_access.c	Fri Jan 28 10:35:48 2005
@@ -164,40 +164,48 @@
 	struct stat statb;
 	wtap	*wth;
 	unsigned int	i;
+	int use_stdin =0;
+
+	/* open stdin if filename is '-' */
+	if( filename && !strcmp(filename,"-") ) use_stdin=1;
+	fprintf(stderr,"test1 %d\n",use_stdin);
 
 	/* First, make sure the file is valid */
-	if (stat(filename, &statb) < 0) {
-		*err = errno;
-		return NULL;
-	}
-	if (S_ISFIFO(statb.st_mode)) {
-		/*
-		 * Opens of FIFOs are allowed only when not opening
-		 * for random access.
-		 *
-		 * XXX - currently, we do seeking when trying to find
-		 * out the file type, so we don't actually support
-		 * opening FIFOs.  However, we may eventually
-		 * do buffering that allows us to do at least some
-		 * file type determination even on pipes, so we
-		 * allow FIFO opens and let things fail later when
-		 * we try to seek.
-		 */
-		if (do_random) {
-			*err = WTAP_ERR_RANDOM_OPEN_PIPE;
+	if( !use_stdin ){	
+		if (stat(filename, &statb) < 0) {
+			*err = errno;
+			return NULL;
+		}
+		if (S_ISFIFO(statb.st_mode)) {
+		
+			/*
+			 * Opens of FIFOs are allowed only when not opening
+			 * for random access.
+			 *
+			 * XXX - currently, we do seeking when trying to find
+			 * out the file type, so we don't actually support
+			 * opening FIFOs.  However, we may eventually
+			 * do buffering that allows us to do at least some
+			 * file type determination even on pipes, so we
+			 * allow FIFO opens and let things fail later when
+			 * we try to seek.
+			 */
+			if (do_random) {
+				*err = WTAP_ERR_RANDOM_OPEN_PIPE;
+				return NULL;
+			}
+		} else if (S_ISDIR(statb.st_mode)) {
+			/*
+			 * Return different errors for "this is a directory"
+			 * and "this is some random special file type", so
+			 * the user can get a potentially more helpful error.
+			 */
+			*err = EISDIR;
+			return NULL;
+		} else if (! S_ISREG(statb.st_mode)) {
+			*err = WTAP_ERR_NOT_REGULAR_FILE;
 			return NULL;
 		}
-	} else if (S_ISDIR(statb.st_mode)) {
-		/*
-		 * Return different errors for "this is a directory"
-		 * and "this is some random special file type", so
-		 * the user can get a potentially more helpful error.
-		 */
-		*err = EISDIR;
-		return NULL;
-	} else if (! S_ISREG(statb.st_mode)) {
-		*err = WTAP_ERR_NOT_REGULAR_FILE;
-		return NULL;
 	}
 
 	errno = ENOMEM;
@@ -214,7 +222,12 @@
 
 	/* Open the file */
 	errno = WTAP_ERR_CANT_OPEN;
-	wth->fd = open(filename, O_RDONLY|O_BINARY);
+	if(use_stdin){
+		wth->fd = dup(0);
+		fprintf(stderr,"test2 %d\n",use_stdin);
+	}else{
+		wth->fd = open(filename, O_RDONLY|O_BINARY);
+	}
 	if (wth->fd < 0) {
 		*err = errno;
 		g_free(wth);