aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-02-15 21:47:57 +0000
committerGuy Harris <guy@alum.mit.edu>2009-02-15 21:47:57 +0000
commitace4af44fc2aecc93c7663f6f27b8deaae5c2a72 (patch)
treeab9611fe056fd19c3674191f606c15790b40380c /rawshark.c
parent8f2e6281c19dbda07c8ee2d7a7f4c3954480f632 (diff)
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 'rawshark.c')
-rw-r--r--rawshark.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/rawshark.c b/rawshark.c
index dd5cc11036..9dc10bcb7b 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -154,6 +154,7 @@ 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);
+static void write_failure_message(const char *filename, int err);
static void protocolinfo_init(char *field);
static gboolean parse_field_string_format(char *format);
@@ -492,7 +493,8 @@ main(int argc, char *argv[])
dissectors, and we must do it before we read the preferences, 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. */
@@ -1626,6 +1628,16 @@ read_failure_message(const char *filename, int err)
}
/*
+ * Write errors are reported with an console message in Rawshark.
+ */
+static void
+write_failure_message(const char *filename, int err)
+{
+ cmdarg_err("An error occurred while writing to the file \"%s\": %s.",
+ filename, strerror(err));
+}
+
+/*
* Report an error in command-line arguments.
*/
void