aboutsummaryrefslogtreecommitdiffstats
path: root/epan/report_err.h
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 /epan/report_err.h
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 'epan/report_err.h')
-rw-r--r--epan/report_err.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/epan/report_err.h b/epan/report_err.h
index 159cd96cee..9717221424 100644
--- a/epan/report_err.h
+++ b/epan/report_err.h
@@ -1,6 +1,13 @@
/* report_err.h
- * Declarations of routines for dissectors to use to report errors to
- * the user (e.g., problems with preference settings)
+ * Declarations of routines for code that can run in GUI and command-line
+ * environments to use to report errors to the user (e.g., I/O errors, or
+ * problems with preference settings).
+ *
+ * The application using libwireshark will register error-reporting
+ * routines, and the routines declared here will call the registered
+ * routines. That way, these routines can be called by code that
+ * doesn't itself know whether to pop up a dialog or print something
+ * to the standard error.
*
* $Id$
*
@@ -36,23 +43,34 @@ extern "C" {
extern void init_report_err(
void (*report_failure)(const char *, va_list),
void (*report_open_failure)(const char *, int, gboolean),
- void (*report_read_failure)(const char *, int));
+ void (*report_read_failure)(const char *, int),
+ void (*report_write_failure)(const char *, int));
+
+/*
+ * Report a general error.
+ */
+extern void report_failure(const char *msg_format, ...);
/*
* Report an error when trying to open a file.
+ * "err" is assumed to be an error code from Wiretap; positive values are
+ * UNIX-style errnos, so this can be used for open failures not from
+ * Wiretap as long as the failure code is just an errno.
*/
extern void report_open_failure(const char *filename, int err,
gboolean for_writing);
/*
* Report an error when trying to read a file.
+ * "err" is assumed to be a UNIX-style errno.
*/
extern void report_read_failure(const char *filename, int err);
/*
- * Report a general error.
+ * Report an error when trying to write a file.
+ * "err" is assumed to be a UNIX-style errno.
*/
-extern void report_failure(const char *msg_format, ...);
+extern void report_write_failure(const char *filename, int err);
#ifdef __cplusplus
}