diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-12-16 07:43:24 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-12-16 07:43:24 +0000 |
commit | fb6554117f62132fbf58ed6af47df9373a2b45f8 (patch) | |
tree | 5e6bfc133443cca9510abe5589d5f49f0844f162 | |
parent | 336086ca213652b3e0161dc10b69e6e090a53b22 (diff) |
some minor fixes: logging and comments fixed
svn path=/trunk/; revision=16819
-rw-r--r-- | dumpcap.c | 25 | ||||
-rw-r--r-- | log.h | 1 | ||||
-rw-r--r-- | tethereal.c | 4 |
3 files changed, 21 insertions, 9 deletions
@@ -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); } @@ -35,6 +35,7 @@ #define LOG_DOMAIN_MAIN "Main" /* enable very verbose capture log debug output */ +/* (might slightly degrade performance) */ /*#define LOG_CAPTURE_VERBOSE*/ diff --git a/tethereal.c b/tethereal.c index 1dc2ae01f6..8f004c2502 100644 --- a/tethereal.c +++ b/tethereal.c @@ -102,6 +102,7 @@ #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(); |