Updates to reflect revision 4 of ethereal-win32-libs.
[obnox/wireshark/wip.git] / mergecap.c
index 74527020b7b74707b14caf8f8a235d19ff0b4a4f..07552bc1216d50b8e0085fef2a7b2938a8eb972c 100644 (file)
@@ -1,6 +1,6 @@
 /* Combine two dump files, either by appending or by merging by timestamp
  *
- * $Id: mergecap.c,v 1.24 2004/06/30 07:04:42 guy Exp $
+ * $Id$
  *
  * Written by Scott Renfro <scott@renfro.org> based on
  * editcap by Richard Sharpe and Guy Harris
@@ -13,6 +13,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <glib.h>
 
 #ifdef HAVE_UNISTD_H
@@ -30,7 +31,7 @@
 #include "getopt.h"
 #endif
 
-#include "cvsversion.h"
+#include "svnversion.h"
 #include "merge.h"
 
 #ifdef HAVE_IO_H
@@ -151,8 +152,8 @@ main(int argc, char *argv[])
 
     case 'h':
       printf("mergecap version %s"
-#ifdef CVSVERSION
-         " (" CVSVERSION ")"
+#ifdef SVNVERSION
+         " (" SVNVERSION ")"
 #endif
          "\n", VERSION);
       usage();
@@ -195,10 +196,11 @@ main(int argc, char *argv[])
     out_file.fd = 1 /*stdout*/;
   } else {
     /* open the outfile */
-    out_file.fd = open(out_filename, O_BINARY | O_WRONLY);
+    out_file.fd = open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
   }
-  if(out_file.fd == -1) {
-    fprintf(stderr, "mergecap: couldn't open output file\n");
+  if (out_file.fd == -1) {
+    fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
+            out_filename, strerror(errno));
     exit(1);
   }