/* dumpcap.c * * $Id$ * * Ethereal - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef NEED_STRERROR_H #include "strerror.h" #endif #ifdef NEED_GETOPT_H #include "getopt.h" #endif #ifdef _WIN32 /* Needed for console I/O */ #include #include #endif #include #include #include "file.h" #include "summary.h" #include "filters.h" #include "color.h" #include "simple_dialog.h" #include "ringbuffer.h" #include "../ui_util.h" #include "util.h" #include "clopts_common.h" #include "cmdarg_err.h" #include "version_info.h" #include #include "pcap-util.h" #ifdef _WIN32 #include "capture-wpcap.h" #include "capture_wpcap_packet.h" #endif #include "log.h" #include "file_util.h" capture_file cfile; GString *comp_info_str, *runtime_info_str; gchar *ethereal_path = NULL; #ifdef _WIN32 static gboolean has_console = TRUE; /* TRUE if app has console */ static void create_console(void); static void destroy_console(void); #endif static void console_log_handler(const char *log_domain, GLogLevelFlags log_level, const char *message, gpointer user_data _U_); capture_options global_capture_opts; capture_options *capture_opts = &global_capture_opts; static void print_usage(gboolean print_ver) { FILE *output; #ifdef _WIN32 create_console(); #endif if (print_ver) { output = stdout; fprintf(output, "This is "PACKAGE " " VERSION "%s" "\n (C) 1998-2005 Gerald Combs " "\n\n%s\n\n%s\n", svnversion, comp_info_str->str, runtime_info_str->str); } else { output = stderr; } fprintf(output, "\n%s [ -vh ] [ -klLnpQS ] [ -a ] ...\n", PACKAGE); fprintf(output, "\t[ -b ] ...\n"); #ifdef _WIN32 fprintf(output, "\t[ -B ]\n"); #endif fprintf(output, "\t[ -c ] [ -f ]\n"); fprintf(output, "\t[ -g ] [ -i ] [ -m ]\n"); fprintf(output, "\t[ -N ] [ -o ] ...\n"); fprintf(output, "\t[ -r ] [ -R ] [ -s ]\n"); fprintf(output, "\t[ -t