Don't check for "(null)" as the result of a printf operation; don't pass
[obnox/wireshark/wip.git] / mergecap.c
index 05bb517666d8090f66ad0d802e1e2bae64c13562..70b4b58ff76d67cb1271ebd8a8257dff550437c7 100644 (file)
 #include <fcntl.h>
 #endif
 
+#ifdef _WIN32
+#include <wsutil/unicode-utils.h>
+#endif /* _WIN32 */
+
 static int
 get_natural_int(const char *string, const char *name)
 {
@@ -143,11 +147,16 @@ int
 main(int argc, char *argv[])
 {
   int          opt;
+
   gboolean     do_append     = FALSE;
   gboolean     verbose       = FALSE;
   int          in_file_count = 0;
   guint        snaplen = 0;
-  int          file_type = WTAP_FILE_PCAP;     /* default to libpcap format */
+#ifdef PCAP_NG_DEFAULT
+  int          file_type = WTAP_FILE_PCAPNG;   /* default to pcap format */
+#else
+  int          file_type = WTAP_FILE_PCAP;     /* default to pcapng format */
+#endif
   int          frame_type = -2;
   int          out_fd;
   merge_in_file_t   *in_files      = NULL;
@@ -162,6 +171,10 @@ main(int argc, char *argv[])
   gboolean     got_read_error = FALSE, got_write_error = FALSE;
   int          count;
 
+#ifdef _WIN32
+  arg_list_utf_16to8(argc, argv);
+#endif /* _WIN32 */
+
   /* Process the options first */
   while ((opt = getopt(argc, argv, "hvas:T:F:w:")) != -1) {
 
@@ -316,7 +329,7 @@ main(int argc, char *argv[])
     out_fd = ws_open(out_filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
     if (out_fd == -1) {
       fprintf(stderr, "mergecap: Couldn't open output file %s: %s\n",
-              out_filename, strerror(errno));
+              out_filename, g_strerror(errno));
       exit(1);
     }
   }