diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-02-15 21:47:57 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-02-15 21:47:57 +0000 |
commit | ace4af44fc2aecc93c7663f6f27b8deaae5c2a72 (patch) | |
tree | ab9611fe056fd19c3674191f606c15790b40380c /dftest.c | |
parent | 8f2e6281c19dbda07c8ee2d7a7f4c3954480f632 (diff) | |
download | wireshark-ace4af44fc2aecc93c7663f6f27b8deaae5c2a72.tar.gz wireshark-ace4af44fc2aecc93c7663f6f27b8deaae5c2a72.tar.bz2 wireshark-ace4af44fc2aecc93c7663f6f27b8deaae5c2a72.zip |
Add a routine to report write errors to the list of failure-reporting
routines handled by epan/report_err.c.
Move copy_binary_file() in file.c to epan/filesystem.c, and rename it to
copy_file_binary_mode() (to clarify that it *can* copy text files;
arguably, *all* files are "binary" unless you're on, say, an IBM 1401
:-)). Have it use the report_err.c routines, so it works in
console-mode programs.
Clean up some comments while we're at it.
svn path=/trunk/; revision=27456
Diffstat (limited to 'dftest.c')
-rw-r--r-- | dftest.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -1,4 +1,5 @@ -/* dftest.c.c +/* dftest.c + * Shows display filter byte-code, for debugging dfilter routines. * * $Id$ * @@ -6,8 +7,6 @@ * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * - * Shows display filter byte-code, for debugging dfilter routines. - * * 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 @@ -55,6 +54,7 @@ static void failure_message(const char *msg_format, va_list ap); static void open_failure_message(const char *filename, int err, gboolean for_writing); static void read_failure_message(const char *filename, int err); +static void write_failure_message(const char *filename, int err); int main(int argc, char **argv) @@ -89,7 +89,8 @@ main(int argc, char **argv) in case any dissectors register preferences. */ epan_init(register_all_protocols, register_all_protocol_handoffs, NULL, NULL, - failure_message, open_failure_message, read_failure_message); + failure_message, open_failure_message, read_failure_message, + write_failure_message); /* now register the preferences for any non-dissector modules. we must do that before we read the preferences as well. */ @@ -191,3 +192,13 @@ read_failure_message(const char *filename, int err) fprintf(stderr, "dftest: An error occurred while reading from the file \"%s\": %s.\n", filename, strerror(err)); } + +/* + * Write errors are reported with an console message in "dftest". + */ +static void +write_failure_message(const char *filename, int err) +{ + fprintf(stderr, "dftest: An error occurred while writing to the file \"%s\": %s.\n", + filename, strerror(err)); +} |