diff options
-rw-r--r-- | capture_opts.c | 2 | ||||
-rw-r--r-- | capture_opts.h | 1 | ||||
-rw-r--r-- | ui/commandline.c | 4 | ||||
-rw-r--r-- | ui/commandline.h | 4 | ||||
-rw-r--r-- | ui/gtk/main.c | 6 | ||||
-rw-r--r-- | ui/qt/main_welcome.cpp | 7 | ||||
-rw-r--r-- | ui/qt/main_window.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 12 |
8 files changed, 29 insertions, 11 deletions
diff --git a/capture_opts.c b/capture_opts.c index 38c39b304b..f383c82a94 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -97,7 +97,6 @@ capture_opts_init(capture_options *capture_opts) #endif capture_opts->real_time_mode = TRUE; capture_opts->show_info = TRUE; - capture_opts->quit_after_cap = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE; capture_opts->restart = FALSE; capture_opts->orig_save_file = NULL; @@ -220,7 +219,6 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio g_log(log_domain, log_level, "Fileformat : %s", (capture_opts->use_pcapng) ? "PCAPNG" : "PCAP"); g_log(log_domain, log_level, "RealTimeMode : %u", capture_opts->real_time_mode); g_log(log_domain, log_level, "ShowInfo : %u", capture_opts->show_info); - g_log(log_domain, log_level, "QuitAfterCap : %u", capture_opts->quit_after_cap); g_log(log_domain, log_level, "MultiFilesOn : %u", capture_opts->multi_files_on); g_log(log_domain, log_level, "FileDuration (%u) : %u", capture_opts->has_file_duration, capture_opts->file_duration); diff --git a/capture_opts.h b/capture_opts.h index 082e189072..4a8bddb1e6 100644 --- a/capture_opts.h +++ b/capture_opts.h @@ -296,7 +296,6 @@ typedef struct capture_options_tag { /* GUI related */ gboolean real_time_mode; /**< Update list of packets in real time */ gboolean show_info; /**< show the info dialog. GTK+ only. */ - gboolean quit_after_cap; /**< Makes a "capture only mode". Implies -k */ gboolean restart; /**< restart after closing is done */ gchar *orig_save_file; /**< the original capture file name (saved for a restart) */ diff --git a/ui/commandline.c b/ui/commandline.c index 7cb8dd3c53..56b621b69e 100644 --- a/ui/commandline.c +++ b/ui/commandline.c @@ -69,6 +69,8 @@ #if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) capture_options global_capture_opts; + +gboolean quit_after_cap; #endif void @@ -393,6 +395,8 @@ void commandline_other_options(int argc, char *argv[], commandline_param_info_t* param_info->enable_heur_slist = NULL; param_info->disable_heur_slist = NULL; + quit_after_cap = getenv("WIRESHARK_QUIT_AFTER_CAPTURE") ? TRUE : FALSE; + while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { switch (opt) { /*** capture option specific ***/ diff --git a/ui/commandline.h b/ui/commandline.h index 6f79bfc0e5..ecd660011c 100644 --- a/ui/commandline.h +++ b/ui/commandline.h @@ -54,6 +54,10 @@ typedef struct commandline_param_info extern void commandline_other_options(int argc, char *argv[], commandline_param_info_t* param_info, gboolean opt_reset); +#if defined(HAVE_LIBPCAP) || defined(HAVE_EXTCAP) +gboolean quit_after_cap; /**< Makes a "capture only mode". Implies -k */ +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 623b092493..20f5c2af6f 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -1508,7 +1508,7 @@ main_capture_cb_capture_update_finished(capture_session *cap_session) } gtk_window_set_icon_list(GTK_WINDOW(top_level), icon_list); - if(global_capture_opts.quit_after_cap) { + if(quit_after_cap) { /* command line asked us to quit after the capture */ /* don't pop up a dialog to ask for unsaved files etc. */ main_do_quit(); @@ -1562,7 +1562,7 @@ main_capture_cb_capture_fixed_finished(capture_session *cap_session _U_) /* We don't have loaded the capture file, this will be done later. * For now we still have simply a blank screen. */ - if(global_capture_opts.quit_after_cap) { + if(quit_after_cap) { /* command line asked us to quit after the capture */ /* don't pop up a dialog to ask for unsaved files etc. */ main_do_quit(); @@ -1614,7 +1614,7 @@ main_capture_cb_capture_failed(capture_session *cap_session _U_) gtk_window_set_icon_list(GTK_WINDOW(top_level), icon_list); - if(global_capture_opts.quit_after_cap) { + if(quit_after_cap) { /* command line asked us to quit after the capture */ /* don't pop up a dialog to ask for unsaved files etc. */ main_do_quit(); diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index 6001639d39..fe28da06e6 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -256,6 +256,7 @@ void MainWelcome::appInitialized() splash_overlay_ = NULL; } +#ifdef HAVE_LIBPCAP // Update each selected device cfilter when the user changes the contents // of the capture filter lineedit. We do so here so that we don't clobber // filters set in the Capture Options / Interfaces dialog or ones set via @@ -287,6 +288,12 @@ void MainWelcome::captureFilterTextEdited(const QString capture_filter) } welcome_ui_->interfaceTree->updateToolTips(); } +#else +// No-op if we don't have capturing. +void MainWelcome::captureFilterTextEdited(const QString) +{ +} +#endif // The interface list selection has changed. At this point the user might // have entered a filter or we might have pre-filled one from a number of diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 78f062a2b3..519bbacabd 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -246,10 +246,12 @@ simple_message_box(ESD_TYPE_E type, gboolean *notagain, void vsimple_error_message_box(const char *msg_format, va_list ap) { +#ifdef HAVE_LIBPCAP // We want to quit after reading the capture file, hence // we don't actually open the error dialog. - if (global_capture_opts.quit_after_cap) + if (quit_after_cap) exit(0); +#endif SimpleDialog sd(gbl_cur_main_window_, ESD_TYPE_ERROR, ESD_BTN_OK, msg_format, ap); sd.exec(); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 881460dca5..131e77bfd1 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -262,8 +262,10 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned main_ui_->statusBar->showExpert(); finish: - if (global_capture_opts.quit_after_cap) +#ifdef HAVE_LIBPCAP + if (quit_after_cap) exit(0); +#endif return ret; } @@ -621,7 +623,7 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *) { setWindowIcon(wsApp->normalIcon()); - if (global_capture_opts.quit_after_cap) { + if (quit_after_cap) { // Command line asked us to quit after capturing. // Don't pop up a dialog to ask for unsaved files etc. exit(0); @@ -644,7 +646,7 @@ void MainWindow::captureCaptureFixedFinished(capture_session *) { setWindowIcon(wsApp->normalIcon()); - if (global_capture_opts.quit_after_cap) { + if (quit_after_cap) { // Command line asked us to quit after capturing. // Don't pop up a dialog to ask for unsaved files etc. exit(0); @@ -668,7 +670,7 @@ void MainWindow::captureCaptureFailed(capture_session *) { setWindowIcon(wsApp->normalIcon()); - if (global_capture_opts.quit_after_cap) { + if (quit_after_cap) { // Command line asked us to quit after capturing. // Don't pop up a dialog to ask for unsaved files etc. exit(0); @@ -780,8 +782,10 @@ void MainWindow::captureFileClosed() { setMenusForSelectedPacket(); setMenusForSelectedTreeRow(); +#ifdef HAVE_LIBPCAP if (!global_capture_opts.multi_files_on) main_ui_->mainStack->setCurrentWidget(main_welcome_); +#endif } void MainWindow::captureFileSaveStarted(const QString &file_path) |