diff --git a/capture.c b/capture.c index 86b7cd1ba3..d1ccfb2dbd 100644 --- a/capture.c +++ b/capture.c @@ -203,8 +203,8 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file) } capture_opts->save_file = g_strdup(new_file); - /* if we are in sync mode, open the new file */ - if(capture_opts->sync_mode) { + /* if we are in real-time mode, open the new file */ + if(capture_opts->real_time_mode) { /* The child process started a capture. Attempt to open the capture file and set up to read it. */ switch(cf_start_tail(capture_opts->cf, capture_opts->save_file, is_tempfile, &err)) { @@ -231,7 +231,7 @@ capture_input_new_packets(capture_options *capture_opts, int to_read) int err; - if(capture_opts->sync_mode) { + if(capture_opts->real_time_mode) { /* Read from the capture file the number of records the child told us it added. XXX - do something if this fails? */ @@ -263,7 +263,7 @@ capture_input_closed(capture_options *capture_opts) int err; - if(capture_opts->sync_mode) { + if(capture_opts->real_time_mode) { /* Read what remains of the capture file, and finish the capture. XXX - do something if this fails? */ switch (cf_finish_tail(capture_opts->cf, &err)) { diff --git a/capture.h b/capture.h index 2acffc4738..dfdc747ec9 100644 --- a/capture.h +++ b/capture.h @@ -53,8 +53,7 @@ typedef struct capture_options_tag { gchar *save_file; /**< the capture file name */ /* GUI related */ - gboolean sync_mode; /**< Fork a child to do the capture, - and sync between them */ + gboolean real_time_mode;/**< Update list of packets in real time */ gboolean show_info; /**< show the info dialog */ gboolean quit_after_cap; /** Makes a "capture only mode". Implies -k */ diff --git a/capture_loop.c b/capture_loop.c index 0be43ae0f1..c65d166f4c 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -106,6 +106,10 @@ #include #include +/* Win32 needs the O_BINARY flag for open() */ +#ifndef O_BINARY +#define O_BINARY 0 +#endif @@ -596,12 +600,7 @@ static int capture_loop_open_input(capture_options *capture_opts, loop_data *ld, } else { /* We couldn't open "iface" as a network device. */ #ifdef _WIN32 - /* On Windows, we don't support capturing on pipes, so we give up. - If this is a child process that does the capturing in sync - mode or fork mode, it shouldn't do any UI stuff until we pop up the - capture-progress window, and, since we couldn't start the - capture, we haven't popped it up. */ - + /* On Windows, we don't support capturing on pipes, so we give up. */ /* On Win32 OSes, the capture devices are probably available to all users; don't warn about permissions problems. @@ -967,8 +966,8 @@ capture_loop_open_output(capture_options *capture_opts, int *save_file_fd) { if (capture_opts->save_file != NULL) { - /* If the Sync option is set, we return to the caller while the capture - * is in progress. Therefore we need to take a copy of save_file in + /* We return to the caller while the capture is in progress. + * Therefore we need to take a copy of save_file in * case the caller destroys it after we return. */ capfile_name = g_strdup(capture_opts->save_file); @@ -1046,8 +1045,6 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct char errmsg[4096+1]; int save_file_fd; - gboolean show_info = capture_opts->show_info || !capture_opts->sync_mode; - /* init the loop data */ ld.go = TRUE; @@ -1145,7 +1142,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct } /* start capture info dialog */ - if(show_info) { + if(capture_opts->show_info) { capture_ui.callback_data = &ld; capture_ui.counts = &ld.counts; capture_info_create(&capture_ui, capture_opts->iface); @@ -1208,7 +1205,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct }*/ /* calculate and display running time */ - if(show_info) { + if(capture_opts->show_info) { cur_time -= start_time; capture_ui.running_time = cur_time; capture_ui.new_packets = ld.packets_sync_pipe; @@ -1267,7 +1264,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct } /* while (ld.go) */ /* close capture info dialog */ - if(show_info) { + if(capture_opts->show_info) { capture_info_destroy(&capture_ui); } diff --git a/capture_opts.c b/capture_opts.c index ddcea18f5c..ac57549b49 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -60,7 +60,7 @@ capture_opts_init(capture_options *capture_opts, void *cfile) capture_opts->promisc_mode = TRUE; /* promiscuous mode is the default */ capture_opts->linktype = -1; /* the default linktype */ capture_opts->save_file = NULL; - capture_opts->sync_mode = TRUE; + capture_opts->real_time_mode = TRUE; capture_opts->show_info = TRUE; capture_opts->quit_after_cap = FALSE; @@ -98,7 +98,7 @@ capture_opts_info(capture_options *capture_opts) { g_warning("Promisc : %u", capture_opts->promisc_mode); g_warning("LinkType : %d", capture_opts->linktype); g_warning("SaveFile : %s", capture_opts->save_file); - g_warning("SyncMode : %u", capture_opts->sync_mode); + g_warning("RealTimeMode : %u", capture_opts->real_time_mode); g_warning("ShowInfo : %u", capture_opts->show_info); g_warning("QuitAfterCap : %u", capture_opts->quit_after_cap); @@ -267,8 +267,8 @@ capture_opts_add_opt(capture_options *capture_opts, const char *appname, int opt capture_opts->has_snaplen = TRUE; capture_opts->snaplen = get_positive_int(appname, optarg, "snapshot length"); break; - case 'S': /* "Sync" mode: used for following file ala tail -f */ - capture_opts->sync_mode = TRUE; + case 'S': /* "Real-Time" mode: used for following file ala tail -f */ + capture_opts->real_time_mode = TRUE; break; case 'w': /* Write to capture file xxx */ capture_opts->save_file = g_strdup(optarg); diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c index dcaad0507c..005fe4ead5 100644 --- a/gtk/capture_dlg.c +++ b/gtk/capture_dlg.c @@ -1009,7 +1009,7 @@ capture_prep(void) sync_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC( "_Update list of packets in real time", accel_group); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sync_cb), - capture_opts->sync_mode); + capture_opts->real_time_mode); SIGNAL_CONNECT(sync_cb, "toggled", capture_prep_adjust_sensitivity, cap_open_w); gtk_tooltips_set_tip(tooltips, sync_cb, "Using this option will show the captured packets immediately on the main screen. " @@ -1365,7 +1365,7 @@ capture_prep_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) { time_unit_option_menu_get_value(stop_duration_om, capture_opts->autostop_duration); } - capture_opts->sync_mode = + capture_opts->real_time_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(sync_cb)); auto_scroll_live = @@ -1417,7 +1417,7 @@ capture_prep_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) { capture_opts->autostop_files = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(stop_files_sb)); - if(capture_opts->sync_mode) + if(capture_opts->real_time_mode) capture_opts->multi_files_on = FALSE; if (capture_opts->multi_files_on) { diff --git a/gtk/main.c b/gtk/main.c index f4fd53ae77..a0f4a19aeb 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1742,7 +1742,7 @@ main(int argc, char *argv[]) } else { capture_opts->promisc_mode = prefs->capture_prom_mode; capture_opts->show_info = prefs->capture_show_info; - capture_opts->sync_mode = prefs->capture_real_time; + capture_opts->real_time_mode = prefs->capture_real_time; auto_scroll_live = prefs->capture_auto_scroll; } @@ -2063,15 +2063,15 @@ main(int argc, char *argv[]) if (capture_opts->multi_files_on) { /* Ring buffer works only under certain conditions: a) ring buffer does not work with temporary files; - b) sync_mode and capture_opts->ringbuffer_on are mutually exclusive - - sync_mode takes precedence; + b) real_time_mode and multi_files_on are mutually exclusive - + real_time_mode takes precedence; c) it makes no sense to enable the ring buffer if the maximum file size is set to "infinite". */ if (capture_opts->save_file == NULL) { fprintf(stderr, "ethereal: Ring buffer requested, but capture isn't being saved to a permanent file.\n"); capture_opts->multi_files_on = FALSE; } -/* if (capture_opts->sync_mode) { +/* if (capture_opts->real_time_mode) { fprintf(stderr, "ethereal: Ring buffer requested, but an \"Update list of packets in real time\" capture is being done.\n"); capture_opts->multi_files_on = FALSE; }*/