Ethereal-dev: [Ethereal-dev] Suggested patch to mergecap.c for writing to stdout

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

From: Bill Guyton <guyton@xxxxxxxxxxx>
Date: Wed, 3 Mar 2004 11:51:23 -0600
Forgive me if someone has already suggested this and it got shot down.
I was hoping to add support to mergecap.c so that a user can specify
- as an output file and have the output go to stdout.

Example:

	mergecap -w - infile1 infile2 ...

CVS Patch is below.

Thanks!
Bill Guyton

Index: ethereal/mergecap.c
===================================================================
RCS file: /cvsroot/ethereal/mergecap.c,v
retrieving revision 1.18
diff -u -r1.18 mergecap.c
--- ethereal/mergecap.c 20 Feb 2004 20:36:13 -0000      1.18
+++ ethereal/mergecap.c 3 Mar 2004 17:34:41 -0000
@@ -265,6 +265,10 @@
     exit(1);
   }
                                                                                
+  /* Allow output to stdout by using - */
+  if (strncmp(out_file->filename, "-", 2) == 0)
+    out_file->filename = "";
+
   out_file->pdh = wtap_dump_open(out_file->filename, out_file->file_type,
                                  out_file->frame_type, snapshot_len, &err);
   if (!out_file->pdh) {