From 05be09a826f87cc914e95e5c5d4f5244da382162 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 21 Feb 2004 22:00:46 +0000 Subject: Get rid of some "#if 0"ed out #includes. Define "report_open_failure()" and "report_read_failure()", so that dissectors can report file open and read errors. svn path=/trunk/; revision=10171 --- dftest.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'dftest.c') diff --git a/dftest.c b/dftest.c index ba8c0df315..c384f74cf6 100644 --- a/dftest.c +++ b/dftest.c @@ -1,6 +1,6 @@ /* dftest.c.c * - * $Id: dftest.c,v 1.7 2004/01/19 03:46:41 ulfl Exp $ + * $Id: dftest.c,v 1.8 2004/02/21 22:00:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -21,7 +21,6 @@ * 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 @@ -41,17 +40,9 @@ #include #include -#if 0 -#include "globals.h" -#include -#include "file.h" -#include "column.h" -#include "print.h" -#include -#include -#endif #include #include +#include #include "prefs.h" #include "util.h" #include "epan/dfilter/dfilter.h" @@ -142,3 +133,26 @@ main(int argc, char **argv) epan_cleanup(); exit(0); } + +/* + * Open/create errors are reported with an console message in "dftest". + */ +void +report_open_failure(const char *filename, int err, gboolean for_writing) +{ + char *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) +{ + fprintf(stderr, "dftest: An error occurred while reading from the file \"%s\": %s.", + filename, strerror(err)); +} -- cgit v1.2.3