Fix a comment; Use consistent indentatation & formatting.

svn path=/trunk/; revision=36225
This commit is contained in:
Bill Meier 2011-03-21 16:57:11 +00:00
parent 4863594e6a
commit f09b320711
1 changed files with 2331 additions and 2324 deletions

View File

@ -335,11 +335,10 @@ static void report_cfilter_error(const char *cfilter, const char *errmsg);
#define MSG_MAX_LENGTH 4096
static void
print_usage(gboolean print_ver) {
print_usage(gboolean print_ver)
{
FILE *output;
if (print_ver) {
output = stdout;
fprintf(output,
@ -411,7 +410,6 @@ print_usage(gboolean print_ver) {
static void
show_version(GString *comp_info_str, GString *runtime_info_str)
{
printf(
"Dumpcap " VERSION "%s\n"
"\n"
@ -1394,7 +1392,8 @@ report_counts_siginfo(int signum _U_)
}
#endif /* SIGINFO */
static void exit_main(int status)
static void
exit_main(int status)
{
#ifdef _WIN32
/* Shutdown windows sockets */
@ -1512,7 +1511,8 @@ cap_pipe_adjust_header(gboolean byte_swapped, struct pcap_hdr *hdr, struct pcapr
* we can let cap_pipe_read run independently, queuing up multiple reads
* for the main thread (and possibly get rid of cap_pipe_read_mtx).
*/
static void *cap_pipe_read(void *ld_ptr) {
static void *cap_pipe_read(void *ld_ptr)
{
loop_data *ld = (loop_data *)ld_ptr;
int bytes_read;
#ifdef _WIN32
@ -1588,7 +1588,8 @@ static void *cap_pipe_read(void *ld_ptr) {
* the string cap_pipe_err_str should be used instead of errno.
*/
static int
cap_pipe_select(int pipe_fd) {
cap_pipe_select(int pipe_fd)
{
fd_set rfds;
struct timeval timeout;
int sel_ret;
@ -2265,11 +2266,11 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
cap_pipe_open_live(capture_opts->iface, &ld->cap_pipe_hdr, ld, errmsg, (int) errmsg_len);
#ifndef _WIN32
if (ld->cap_pipe_fd == -1) {
if (ld->cap_pipe_fd == -1)
#else
if (ld->cap_pipe_h == INVALID_HANDLE_VALUE) {
if (ld->cap_pipe_h == INVALID_HANDLE_VALUE)
#endif
{
if (ld->cap_pipe_err == PIPNEXIST) {
/* Pipe doesn't exist, so output message for interface */
get_capture_device_open_failure_messages(open_err_str,
@ -2313,8 +2314,8 @@ capture_loop_open_input(capture_options *capture_opts, loop_data *ld,
}
/* close the capture input file (pcap or capture pipe) */
static void capture_loop_close_input(loop_data *ld) {
static void capture_loop_close_input(loop_data *ld)
{
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_close_input");
/* if open, close the capture pipe "input file" */
@ -2383,10 +2384,10 @@ capture_loop_init_filter(pcap_t *pcap_h, gboolean from_cap_pipe,
/* set up to write to the already-opened capture output file/files */
static gboolean
capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *errmsg, int errmsg_len) {
capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *errmsg, int errmsg_len)
{
int err;
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_init_output");
/* get snaplen */
@ -2450,7 +2451,8 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
}
static gboolean
capture_loop_close_output(capture_options *capture_opts, loop_data *ld, int *err_close) {
capture_loop_close_output(capture_options *capture_opts, loop_data *ld, int *err_close)
{
g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "capture_loop_close_output");
@ -2637,7 +2639,8 @@ capture_loop_dispatch(capture_options *capture_opts _U_, loop_data *ld,
* want to grab only the characters between the '{' and '}' delimiters.
*
* Returns a GString that must be freed with g_string_free(). */
static GString *isolate_uuid(const char *iface)
static GString *
isolate_uuid(const char *iface)
{
gchar *ptr;
GString *gstr;
@ -2660,8 +2663,8 @@ static GString *isolate_uuid(const char *iface)
/* Returns TRUE if the file opened successfully, FALSE otherwise. */
static gboolean
capture_loop_open_output(capture_options *capture_opts, int *save_file_fd,
char *errmsg, int errmsg_len) {
char *errmsg, int errmsg_len)
{
char *tmpname;
gchar *capfile_name;
gchar *prefix;
@ -3006,18 +3009,20 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
/* Only update once a second (Win32: 500ms) so as not to overload slow
* displays. This also prevents too much context-switching between the
* dumpcap and wireshark processes */
cur_time = TIME_GET();
#ifdef _WIN32
if ( (cur_time - upd_time) > 500) {
#define DUMPCAP_UPD_TIME 500
#else
if (cur_time - upd_time > 0) {
#define DUMPCAP_UPD_TIME 0
#endif
cur_time = TIME_GET();
if ( (cur_time - upd_time) > DUMPCAP_UPD_TIME) {
upd_time = cur_time;
/*if (pcap_stats(pch, stats) >= 0) {
#if 0
if (pcap_stats(pch, stats) >= 0) {
*stats_known = TRUE;
}*/
}
#endif
/* Let the parent process know. */
if (global_ld.inpkts_to_sync_pipe) {
/* do sync here */
@ -3096,7 +3101,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
else if (global_ld.from_cap_pipe && global_ld.cap_pipe_err == PIPERR)
report_capture_error(errmsg, "");
/* did we had an error while capturing? */
/* did we have an output error while capturing? */
if (global_ld.err == 0) {
write_ok = TRUE;
} else {
@ -3775,8 +3780,10 @@ main(int argc, char *argv[])
}
if (!global_capture_opts.has_autostop_filesize && !global_capture_opts.has_file_duration) {
cmdarg_err("Ring buffer requested, but no maximum capture file size or duration were specified.");
#if 0
/* XXX - this must be redesigned as the conditions changed */
/* global_capture_opts.multi_files_on = FALSE;*/
global_capture_opts.multi_files_on = FALSE;
#endif
}
}
}