cfutils.h \
clopts_common.h \
cmdarg_err.h \
- console_io.h \
color.h \
disabled_protos.h \
file.h \
#include "capture_opts.h"
#include "ringbuffer.h"
#include "clopts_common.h"
-#include "console_io.h"
#include "cmdarg_err.h"
#include "capture_ifinfo.h"
data_link_info_t *data_link_info;
if (caps->can_set_rfmon)
- fprintf_stderr("Data link types of interface %s when %sin monitor mode (use option -y to set):\n",
- name, monitor_mode ? "" : "not ");
+ printf("Data link types of interface %s when %sin monitor mode (use option -y to set):\n",
+ name, monitor_mode ? "" : "not ");
else
- fprintf_stderr("Data link types of interface %s (use option -y to set):\n", name);
+ printf("Data link types of interface %s (use option -y to set):\n", name);
for (lt_entry = caps->data_link_types; lt_entry != NULL;
lt_entry = g_list_next(lt_entry)) {
data_link_info = (data_link_info_t *)lt_entry->data;
- fprintf_stderr(" %s", data_link_info->name);
+ printf(" %s", data_link_info->name);
if (data_link_info->description != NULL)
- fprintf_stderr(" (%s)", data_link_info->description);
+ printf(" (%s)", data_link_info->description);
else
- fprintf_stderr(" (not supported)");
- fprintf_stderr("\n");
+ printf(" (not supported)");
+ printf("\n");
}
}
for (if_entry = g_list_first(if_list); if_entry != NULL;
if_entry = g_list_next(if_entry)) {
if_info = (if_info_t *)if_entry->data;
- fprintf_stderr("%d. %s", i++, if_info->name);
+ printf("%d. %s", i++, if_info->name);
/* Print the interface friendly name, if it exists;
if not fall back to vendor description, if it exists. */
if (if_info->friendly_name != NULL){
- fprintf_stderr(" (%s)", if_info->friendly_name);
+ printf(" (%s)", if_info->friendly_name);
} else {
if (if_info->vendor_description != NULL)
- fprintf_stderr(" (%s)", if_info->vendor_description);
+ printf(" (%s)", if_info->vendor_description);
}
- fprintf_stderr("\n");
+ printf("\n");
}
}
+++ /dev/null
-/* console_io.h
- * Declarations of routines to print to the standard error, and, in
- * GUI programs on Windows, to create a console in which to display
- * the standard error.
- *
- * $Id$
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __CONSOLE_IO_H__
-#define __CONSOLE_IO_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * Print to the standard error. On Windows, create a console for the
- * standard error to show up on, if necessary.
- * XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
- * terminal isn't the standard error?
- */
-extern void
-vfprintf_stderr(const char *fmt, va_list ap);
-
-extern void
-fprintf_stderr(const char *fmt, ...)
- G_GNUC_PRINTF(1, 2);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CMDARG_ERR_H__ */
#include "ringbuffer.h"
#include "clopts_common.h"
-#include "console_io.h"
#include "cmdarg_err.h"
#include "version_info.h"
wireshark_svnversion, get_copyright_info(), comp_info_str->str, runtime_info_str->str);
}
-/*
- * Print to the standard error. This is a command-line tool, so there's
- * no need to pop up a console.
- */
-void
-vfprintf_stderr(const char *fmt, va_list ap)
-{
- vfprintf(stderr, fmt, ap);
-}
-
-void
-fprintf_stderr(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- va_end(ap);
-}
-
/*
* Report an error in command-line arguments.
*/
#include <epan/addr_resolv.h>
#include "ui/util.h"
#include "clopts_common.h"
-#include "console_io.h"
#include "cmdarg_err.h"
#include "version_info.h"
#include <epan/plugins.h>
filename, g_strerror(err));
}
-/*
- * Print to the standard error. This is a command-line tool, so there's
- * no need to pop up a console.
- */
-void
-vfprintf_stderr(const char *fmt, va_list ap)
-{
- vfprintf(stderr, fmt, ap);
-}
-
-void
-fprintf_stderr(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- va_end(ap);
-}
-
/*
* Report an error in command-line arguments.
*/
#ifdef _WIN32 /* Needed for console I/O */
#if _MSC_VER < 1500
/* AttachConsole() needs this #define! */
+/* But we're not calling it from here any more; do we need this? */
#define _WIN32_WINNT 0x0501
#endif
+
#include <fcntl.h>
#include <conio.h>
#include <ui/win32/console_win32.h>
static void
show_version(void)
{
-#ifdef _WIN32
- create_console();
-#endif
-
printf(PACKAGE " " VERSION "%s\n"
"\n"
"%s"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
-
-#ifdef _WIN32
- destroy_console();
-#endif
-}
-
-/*
- * Print to the standard error. On Windows, create a console for the
- * standard error to show up on, if necessary.
- * XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
- * terminal isn't the standard error?
- */
-void
-vfprintf_stderr(const char *fmt, va_list ap)
-{
-#ifdef _WIN32
- create_console();
-#endif
- vfprintf(stderr, fmt, ap);
-}
-
-void
-fprintf_stderr(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- va_end(ap);
}
/*
{
va_list ap;
- fprintf_stderr("wireshark: ");
+#ifdef _WIN32
+ create_console();
+#endif
+ fprintf(stderr, "wireshark: ");
va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
- fprintf_stderr("\n");
+ fprintf(stderr, "\n");
}
/*
{
va_list ap;
+#ifdef _WIN32
+ create_console();
+#endif
va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- fprintf_stderr("\n");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
va_end(ap);
}
}
exit(2);
}
+#ifdef _WIN32
+ create_console();
+#endif /* _WIN32 */
capture_opts_print_interfaces(if_list);
free_interface_list(if_list);
+#ifdef _WIN32
+ destroy_console();
+#endif /* _WIN32 */
exit(0);
-#else
+#else /* HAVE_LIBPCAP */
capture_option_specified = TRUE;
arg_error = TRUE;
-#endif
+#endif /* HAVE_LIBPCAP */
break;
case 'h': /* Print help and exit */
print_usage(TRUE);
}
break;
case 'v': /* Show version and exit */
+#ifdef _WIN32
+ create_console();
+#endif
show_version();
+#ifdef _WIN32
+ destroy_console();
+#endif
exit(0);
break;
case 'X':
cmdarg_err("The capture device \"%s\" has no data link types.", device.name);
exit(2);
}
+#ifdef _WIN32
+ create_console();
+#endif /* _WIN32 */
#if defined(HAVE_PCAP_CREATE)
capture_opts_print_if_capabilities(caps, device.name, device.monitor_mode_supported);
#else
capture_opts_print_if_capabilities(caps, device.name, FALSE);
#endif
+#ifdef _WIN32
+ destroy_console();
+#endif /* _WIN32 */
free_if_capabilities(caps);
}
}
#include "ringbuffer.h"
#include "ui/util.h"
#include "clopts_common.h"
-#include "console_io.h"
#include "cmdarg_err.h"
#include "version_info.h"
#include "merge.h"
static void
show_version(void)
{
-#ifdef _WIN32
- create_console();
-#endif
-
printf(PACKAGE " " VERSION "%s\n"
"\n"
"%s"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
-
-#ifdef _WIN32
- destroy_console();
-#endif
-}
-
-/*
- * Print to the standard error. On Windows, create a console for the
- * standard error to show up on, if necessary.
- * XXX - pop this up in a window of some sort on UNIX+X11 if the controlling
- * terminal isn't the standard error?
- */
-// xxx copied from ../gtk/main.c
-void
-vfprintf_stderr(const char *fmt, va_list ap)
-{
-#ifdef _WIN32
- create_console();
-#endif
- vfprintf(stderr, fmt, ap);
-}
-
-void
-fprintf_stderr(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- va_end(ap);
}
/*
{
va_list ap;
- fprintf_stderr("wireshark: ");
+#ifdef _WIN32
+ create_console();
+#endif
+ fprintf(stderr, "wireshark: ");
va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
+ vfprintf(stderr, fmt, ap);
va_end(ap);
- fprintf_stderr("\n");
+ fprintf(stderr, "\n");
}
/*
{
va_list ap;
+#ifdef _WIN32
+ create_console();
+#endif
va_start(ap, fmt);
- vfprintf_stderr(fmt, ap);
- fprintf_stderr("\n");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
va_end(ap);
}
}
exit(2);
}
+#ifdef _WIN32
+ create_console();
+#endif /* _WIN32 */
capture_opts_print_interfaces(if_list);
free_interface_list(if_list);
+#ifdef _WIN32
+ destroy_console();
+#endif /* _WIN32 */
exit(0);
-#else
+#else /* HAVE_LIBPCAP */
capture_option_specified = TRUE;
arg_error = TRUE;
-#endif
+#endif /* HAVE_LIBPCAP */
break;
case 'h': /* Print help and exit */
print_usage(TRUE);
}
break;
case 'v': /* Show version and exit */
+#ifdef _WIN32
+ create_console();
+#endif
show_version();
+#ifdef _WIN32
+ destroy_console();
+#endif
exit(0);
break;
case 'X':
/*
- * Extension command line options have to be processed before
- * we call epan_init() as they are supposed to be used by dissectors
- * or taps very early in the registration process.
- */
+ * Extension command line options have to be processed before
+ * we call epan_init() as they are supposed to be used by dissectors
+ * or taps very early in the registration process.
+ */
ex_opt_add(optarg);
break;
case '?': /* Ignore errors - the "real" scan will catch them. */
// exit(2);
// }
//#if defined(HAVE_PCAP_CREATE)
+//#ifdef _WIN32
+// create_console();
+//#endif /* _WIN32 */
// capture_opts_print_if_capabilities(caps, device.name, device.monitor_mode_supported);
//#else
// capture_opts_print_if_capabilities(caps, device.name, FALSE);
//#endif
+//#ifdef _WIN32
+// destroy_console();
+//#endif /* _WIN32 */
// free_if_capabilities(caps);
// }
// }
#include <wsutil/file_util.h>
#include "console_win32.h"
-#include "../../console_io.h"
#if _MSC_VER < 1500
/* AttachConsole() needs this #define! */