some minor fixes: logging and comments fixed
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Dec 2005 07:43:24 +0000 (07:43 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Dec 2005 07:43:24 +0000 (07:43 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16819 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c
log.h
tethereal.c

index 57441f33e806a2b33c794f0743a7502d280c66c7..c0dc3355aab31e56cafaadfb76149474934cba4f 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -56,7 +56,7 @@
 
 #ifdef _WIN32
 #include "capture-wpcap.h"
-#include "capture_wpcap_packet.h"
+/*#include "capture_wpcap_packet.h"*/
 #endif
 
 #include "capture.h"
@@ -337,17 +337,17 @@ main(int argc, char *argv[])
       /*** capture option specific ***/
       case 'a':        /* autostop criteria */
       case 'b':        /* Ringbuffer option */
-      case 'c':        /* Capture xxx packets */
+      case 'c':        /* Capture x packets */
       case 'f':        /* capture filter */
-      case 'i':        /* Use interface xxx */
+      case 'i':        /* Use interface x */
       case 'p':        /* Don't capture in promiscuous mode */
       case 's':        /* Set the snapshot (capture) length */
-      case 'w':        /* Write to capture file xxx */
+      case 'w':        /* Write to capture file x */
       case 'y':        /* Set the pcap data link type */
 #ifdef _WIN32
       case 'B':        /* Buffer size */
       /* Hidden option supporting Sync mode */
-      case 'Z':        /* Write to pipe FD XXX */
+      case 'Z':        /* Write to pipe FD x */
 #endif /* _WIN32 */
         capture_opts_add_opt(capture_opts, opt, optarg, &start_capture);
         break;
@@ -371,7 +371,7 @@ main(int argc, char *argv[])
   argv += optind;
   if (argc >= 1) {
       /* user specified file name as regular command-line argument */
-      /* XXX - use it as the capture file name (or somthing else)? */
+      /* XXX - use it as the capture file name (or something else)? */
     argc--;
     argv++;
   }
@@ -607,6 +607,9 @@ pipe_write_block(int pipe, char indicator, int len, const char *msg)
 
     /*g_warning("write %d enter", pipe);*/
 
+    /* XXX - find a suitable way to switch between pipe and console output */
+    return;
+
     g_assert(indicator < '0' || indicator > '9');
     g_assert(len <= SP_MAX_MSG_LEN);
 
@@ -643,13 +646,17 @@ sync_pipe_packet_count_to_parent(int packet_count)
 {
     char tmp[SP_DECISIZE+1+1];
 
+
+    count += packet_count;
+    fprintf(stderr, "\r%u", count);
+    /* stderr could be line buffered */
+    fflush(stderr);
+
+
     g_snprintf(tmp, sizeof(tmp), "%d", packet_count);
 
     /*g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "sync_pipe_packet_count_to_parent: %s", tmp);*/
 
-    count += packet_count;
-    fprintf(stderr, "\rPackets: %u", count);
-
     pipe_write_block(1, SP_PACKET_COUNT, strlen(tmp)+1, tmp);
 }
 
diff --git a/log.h b/log.h
index 4d13bbecf2bfee51497e2778a7a139bf14f4d9aa..768d3db8f2df66b38115ab2445ccb25e4f852d2a 100644 (file)
--- a/log.h
+++ b/log.h
@@ -35,6 +35,7 @@
 #define LOG_DOMAIN_MAIN                                "Main"
 
 /* enable very verbose capture log debug output */
+/* (might slightly degrade performance) */
 /*#define LOG_CAPTURE_VERBOSE*/
 
 
index 1dc2ae01f6f0029aef09860e8133efbf685fc524..8f004c2502780c0e23d84b84eba60fdd42793844 100644 (file)
 #include "capture_loop.h"
 #endif /* HAVE_LIBPCAP */
 #include "epan/emem.h"
+#include "log.h"
 
 /*
  * This is the template for the decode as option; it is shared between the
@@ -649,6 +650,9 @@ main(int argc, char *argv[])
   g_log_set_handler(NULL,
                    log_flags,
                    log_func_ignore, NULL /* user_data */);
+  g_log_set_handler(LOG_DOMAIN_CAPTURE_CHILD,
+                   log_flags,
+                   log_func_ignore, NULL /* user_data */);
 
   /* initialize memory allocation subsystem */
   ep_init_chunk();