Pull quit_after_cap out of the global capture options.
Really, all the GUI-related options should be pulled out, so they're not cluttering up dumpcap and tshark. Change-Id: I0276dee2be48bae3498a819d8c0c2747fe1352e7 Reviewed-on: https://code.wireshark.org/review/16180 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
72d9785cfc
commit
3f49e897f6
|
@ -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);
|
||||
|
|
|
@ -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) */
|
||||
|
||||
|
|
|
@ -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 ***/
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue