#ifdef HAVE_LIBPCAP
#include <pcap.h>
-#include "pcap-util.h"
+#include "capture-pcap-util.h"
#include "capture.h"
#include "capture_loop.h"
#include "capture_sync.h"
#include "decode_as_dlg.h"
#include "webbrowser.h"
#include "capture_dlg.h"
-#if 0
+#ifdef SHOW_WELCOME_PAGE
#include "../image/eicon3d64.xpm"
#endif
#include "capture_ui_utils.h"
if (print_ver) {
output = stdout;
- fprintf(output, "This is "PACKAGE " " VERSION "%s"
- "\n (C) 1998-2005 Gerald Combs <gerald@ethereal.com>"
- "\n\n%s\n\n%s\n",
- svnversion, comp_info_str->str, runtime_info_str->str);
+ fprintf(output, "This is "PACKAGE " " VERSION "%s\n"
+ "\n"
+ "%s"
+ "\n"
+ "%s"
+ "\n"
+ "%s",
+ svnversion, get_copyright_info(), comp_info_str->str,
+ runtime_info_str->str);
} else {
output = stderr;
}
#ifdef HAVE_LIBPCAP
- fprintf(output, "\n%s [ -vh ] [ -klLnpQS ] [ -a <capture autostop condition> ] ...\n", PACKAGE);
+ fprintf(output, "\n%s [ -vh ] [ -DklLnpQS ] [ -a <capture autostop condition> ] ...\n", PACKAGE);
fprintf(output, "\t[ -b <capture ring buffer option> ] ...\n");
#ifdef _WIN32
fprintf(output, "\t[ -B <capture buffer size> ]\n");
create_console();
#endif
- printf(PACKAGE " " VERSION "%s\n\n%s\n\n%s\n",
- svnversion, comp_info_str->str, runtime_info_str->str);
+ printf(PACKAGE " " VERSION "%s\n"
+ "\n"
+ "%s"
+ "\n"
+ "%s"
+ "\n"
+ "%s",
+ svnversion, get_copyright_info(), comp_info_str->str,
+ runtime_info_str->str);
#ifdef _WIN32
destroy_console();
/* Destroy all windows, which refer to the
capture file we're closing. */
- destroy_cfile_wins();
+ destroy_packet_wins();
+ file_save_as_destroy();
/* Clear any file-related status bar messages.
XXX - should be "clear *ALL* file-related status bar messages;
/* Set up main window for a capture file. */
main_set_for_capture_file(TRUE);
+
+ if(capture_opts->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();
+ }
}
static void
a capture. */
set_menus_for_capture_in_progress(FALSE);
+ /* Restore the standard title bar message */
+ /* (just in case we have trouble opening the capture file). */
+ set_main_window_name("The Ethereal Network Analyzer");
+
/* We don't have loaded the capture file, this will be done later.
* For now we still have simply a blank screen. */
+
+ if(capture_opts->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();
+ }
}
static void
int err;
#ifdef HAVE_LIBPCAP
gboolean start_capture = FALSE;
- GList *if_list;
- if_info_t *if_info;
- GList *lt_list, *lt_entry;
- data_link_info_t *data_link_info;
- gchar err_str[PCAP_ERRBUF_SIZE];
- gchar *cant_get_if_list_errstr;
gboolean stats_known;
struct pcap_stat stats;
#else
guint go_to_packet = 0;
int optind_initial;
-#define OPTSTRING_INIT "a:b:c:f:g:Hhi:klLm:nN:o:pQr:R:Ss:t:vw:y:z:"
+#define OPTSTRING_INIT "a:b:c:Df:g:Hhi:klLm:nN:o:pQr:R:Ss:t:vw:y:z:"
#ifdef HAVE_LIBPCAP
#ifdef _WIN32
-#define OPTSTRING_CHILD "W:Z:"
+#define OPTSTRING_CHILD "Z:"
#define OPTSTRING_WIN32 "B:"
#else
-#define OPTSTRING_CHILD "W:"
+#define OPTSTRING_CHILD ""
#define OPTSTRING_WIN32 ""
#endif /* _WIN32 */
#else
ep_init_chunk();
se_init_chunk();
- /*** create the compile and runtime version strings ***/
#ifdef _WIN32
/* Load wpcap if possible. Do this before collecting the run-time version information */
load_wpcap();
#endif
splash_win = splash_new("Loading Ethereal ...");
- splash_update(splash_win, "Registering dissectors ...");
+ splash_update(splash_win, "Init dissectors ...");
/* Register all dissectors; we must do this before checking for the
"-G" flag, as the "-G" flag dumps information registered by the
epan_init(PLUGIN_DIR,register_all_protocols,register_all_protocol_handoffs,
failure_alert_box,open_failure_alert_box,read_failure_alert_box);
- splash_update(splash_win, "Registering tap listeners ...");
+ splash_update(splash_win, "Init tap listeners ...");
/* Register all tap listeners; we do this before we parse the arguments,
as the "-z" argument can specify a registered tap. */
arg_error = TRUE;
#endif
break;
-#ifdef HAVE_LIBPCAP
- /* This is a hidden option supporting Sync mode, so we don't set
- * the error flags for the user in the non-libpcap case.
- */
- case 'W': /* Write to capture file FD xxx */
- capture_opts_add_opt(capture_opts, opt, optarg, &start_capture);
- break;
-#endif
/*** all non capture option specific ***/
+ case 'D': /* Print a list of capture devices and exit */
+#ifdef HAVE_LIBPCAP
+ capture_opts_list_interfaces();
+ exit(0);
+#else
+ capture_option_specified = TRUE;
+ arg_error = TRUE;
+#endif
+ break;
case 'g': /* Go to packet */
go_to_packet = get_positive_int(optarg, "go to packet");
break;
if (start_capture || list_link_layer_types) {
/* Did the user specify an interface to use? */
- if (capture_opts->iface == NULL) {
- /* No - is a default specified in the preferences file? */
- if (prefs->capture_device != NULL) {
- /* Yes - use it. */
- capture_opts->iface = g_strdup(get_if_name(prefs->capture_device));
- } else {
- /* No - pick the first one from the list of interfaces. */
- if_list = get_interface_list(&err, err_str);
- if (if_list == NULL) {
- switch (err) {
-
- case CANT_GET_INTERFACE_LIST:
- cant_get_if_list_errstr = cant_get_if_list_error_message(err_str);
- cmdarg_err("%s", cant_get_if_list_errstr);
- g_free(cant_get_if_list_errstr);
- break;
-
- case NO_INTERFACES_FOUND:
- cmdarg_err("There are no interfaces on which a capture can be done");
- break;
- }
- exit(2);
- }
- if_info = if_list->data; /* first interface */
- capture_opts->iface = g_strdup(if_info->name);
- free_interface_list(if_list);
- }
+ if (!capture_opts_trim_iface(capture_opts,
+ (prefs->capture_device) ? get_if_name(prefs->capture_device) : NULL)) {
+ exit(2);
}
}
if (list_link_layer_types) {
- /* Get the list of link-layer types for the capture device. */
- lt_list = get_pcap_linktype_list(capture_opts->iface, err_str);
- if (lt_list == NULL) {
- if (err_str[0] != '\0') {
- cmdarg_err("The list of data link types for the capture device could not be obtained (%s)."
- "Please check to make sure you have sufficient permissions, and that\n"
- "you have the proper interface or pipe specified.\n", err_str);
- } else
- cmdarg_err("The capture device has no data link types.");
- exit(2);
- }
- g_warning("Data link types (use option -y to set):");
- for (lt_entry = lt_list; lt_entry != NULL;
- lt_entry = g_list_next(lt_entry)) {
- data_link_info = lt_entry->data;
- g_warning(" %s", data_link_info->name);
- if (data_link_info->description != NULL)
- g_warning(" (%s)", data_link_info->description);
- else
- g_warning(" (not supported)");
- putchar('\n');
- }
- free_pcap_linktype_list(lt_list);
+ capture_opts_list_link_layer_types(capture_opts);
exit(0);
}
- capture_opts_trim(capture_opts, MIN_PACKET_SIZE);
+ capture_opts_trim_snaplen(capture_opts, MIN_PACKET_SIZE);
+ capture_opts_trim_ring_num_files(capture_opts);
#endif /* HAVE_LIBPCAP */
/* Notify all registered modules that have had any of their preferences
}
-#if 0
+#ifdef SHOW_WELCOME_PAGE
/* XXX - There seems to be some disagreement about if and how this feature should be implemented.
As I currently don't have the time to continue this, it's temporarily disabled. - ULFL */
GtkWidget *
return welcome_scrollw;
}
-#endif /* 0 */
-
+#else
static GtkWidget *
welcome_new(void)
{
/* this is just a dummy to fill up window space, simply showing nothing */
return scrolled_window_new(NULL, NULL);
}
+#endif