aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-04-16 23:17:13 +0000
committerGuy Harris <guy@alum.mit.edu>2004-04-16 23:17:13 +0000
commitd209115ba38e1f5082ecdf702782da0f09a727d2 (patch)
tree16229621c009c052580c6152892a945af94e5bba /tethereal.c
parenta0146ed5bedbbee168eb8f0fc226cd56fa1dbd92 (diff)
downloadwireshark-d209115ba38e1f5082ecdf702782da0f09a727d2.tar.gz
wireshark-d209115ba38e1f5082ecdf702782da0f09a727d2.tar.bz2
wireshark-d209115ba38e1f5082ecdf702782da0f09a727d2.zip
Add a "report_failure()" routine to allow dissectors to report arbitrary
errors to the user. Use that, rather than "g_warning()", in the Diameter dissector to report errors reading the dictionary. Make the format argument to "simple_dialog()" a "const" pointer. Fix up the read-error message in Tethereal to end with a newline. If a simple dialog is requested before the main window or the capture-control window is popped up, queue it up and pop the queued messages up once the main or capture-control window is displayed. svn path=/trunk/; revision=10616
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/tethereal.c b/tethereal.c
index 1efad85f36..32f1dc36c5 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.234 2004/04/16 18:17:47 ulfl Exp $
+ * $Id: tethereal.c,v 1.235 2004/04/16 23:16:28 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -187,6 +187,7 @@ static int pipe_dispatch(int, loop_data *, struct pcap_hdr *, \
static void open_failure_message(const char *filename, int err,
gboolean for_writing);
+static void failure_message(const char *msg_format, va_list ap);
static void read_failure_message(const char *filename, int err);
capture_file cfile;
@@ -840,7 +841,7 @@ main(int argc, char *argv[])
dissectors, and we must do it before we read the preferences, in
case any dissectors register preferences. */
epan_init(PLUGIN_DIR,register_all_protocols,register_all_protocol_handoffs,
- open_failure_message, read_failure_message);
+ failure_message,open_failure_message,read_failure_message);
/* Register all tap listeners; we do this before we parse the arguments,
as the "-z" argument can specify a registered tap. */
@@ -2977,11 +2978,9 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
static void
open_failure_message(const char *filename, int err, gboolean for_writing)
{
- char *errmsg;
-
- errmsg = g_strdup_printf(file_open_error_message(err, for_writing), filename);
- fprintf(stderr, "tethereal: %s\n", errmsg);
- g_free(errmsg);
+ fprintf(stderr, "tethereal: ");
+ fprintf(stderr, file_open_error_message(err, for_writing), filename);
+ fprintf(stderr, "\n");
}
int
@@ -3330,11 +3329,22 @@ pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr,
#endif /* HAVE_LIBPCAP */
/*
+ * General errors are reported with an console message in Tethereal.
+ */
+static void
+failure_message(const char *msg_format, va_list ap)
+{
+ fprintf(stderr, "tethereal: ");
+ vfprintf(stderr, msg_format, ap);
+ fprintf(stderr, "\n");
+}
+
+/*
* Read errors are reported with an console message in Tethereal.
*/
static void
read_failure_message(const char *filename, int err)
{
- fprintf(stderr, "tethereal: An error occurred while reading from the file \"%s\": %s.",
+ fprintf(stderr, "tethereal: An error occurred while reading from the file \"%s\": %s.\n",
filename, strerror(err));
}