diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2004-03-23 21:19:58 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2004-03-23 21:19:58 +0000 |
commit | 7e46a7722c24e5d2fb083bf908c6237246fed327 (patch) | |
tree | 9dba3131d845040ea0ab402a8b3e4a5147d5d315 /dftest.c | |
parent | 83eea317696851f5456c7fb9b27789ba4cc2c017 (diff) |
Make "epan_init()" take, as additional arguments, pointers to routines
that dissectors should call to report file open and read errors, and
have "report_open_failure()" and "report_read_failure()" call through
those pointers, rather than being defined and exported by the
application using libethereal - instead, the application would define
those functions and pass pointers to them to 'epan_init()".
Move "report_err.h" to the epan directory, as the functions it declares
are now part of the libethereal API.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10470 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'dftest.c')
-rw-r--r-- | dftest.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -1,6 +1,6 @@ /* dftest.c.c * - * $Id: dftest.c,v 1.9 2004/03/18 19:04:31 obiot Exp $ + * $Id: dftest.c,v 1.10 2004/03/23 21:19:55 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -50,6 +50,10 @@ packet_info pi; +static void open_failure_message(const char *filename, int err, + gboolean for_writing); +static void read_failure_message(const char *filename, int err); + int main(int argc, char **argv) { @@ -67,7 +71,8 @@ main(int argc, char **argv) by the 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); + register_all_protocol_handoffs, + open_failure_message, read_failure_message); /* now register the preferences for any non-dissector modules. we must do that before we read the preferences as well. */ @@ -138,22 +143,23 @@ main(int argc, char **argv) /* * Open/create errors are reported with an console message in "dftest". */ -void -report_open_failure(const char *filename, int err, gboolean for_writing) +static void +open_failure_message(const char *filename, int err, gboolean for_writing) { - char *errmsg; + char *errmsg; - errmsg = g_strdup_printf(file_open_error_message(err, for_writing), filename); - fprintf(stderr, "dftest: %s\n", errmsg); - g_free(errmsg); + errmsg = g_strdup_printf(file_open_error_message(err, for_writing), + filename); + fprintf(stderr, "dftest: %s\n", errmsg); + g_free(errmsg); } /* * Read errors are reported with an console message in "dftest". */ -void -report_read_failure(const char *filename, int err) +static void +read_failure_message(const char *filename, int err) { - fprintf(stderr, "dftest: An error occurred while reading from the file \"%s\": %s.", - filename, strerror(err)); + fprintf(stderr, "dftest: An error occurred while reading from the file \"%s\": %s.", + filename, strerror(err)); } |