aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/print_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-01-25 00:58:13 +0000
committerGuy Harris <guy@alum.mit.edu>2004-01-25 00:58:13 +0000
commit7502ac216ad7dcef048f1418eb8e34edb953ddac (patch)
tree6285e0506f94a9c4dfbf986131dd1b0f316d19bd /gtk/print_dlg.c
parent064d5e5e07127d79d1bb02b3c11ff4a5e2ef7939 (diff)
downloadwireshark-7502ac216ad7dcef048f1418eb8e34edb953ddac.tar.gz
wireshark-7502ac216ad7dcef048f1418eb8e34edb953ddac.tar.bz2
wireshark-7502ac216ad7dcef048f1418eb8e34edb953ddac.zip
There's no need to keep a "FILE *" for the file being printed to in a
"capture_file" structure. Keep it locally, instead. Check for errors when printing packets. Report failure to open a print destination and failure to write to a print destination differently. Don't have the "print preamble" and "print final" routines return success/failure indications - revert to the old scheme where they didn't, and have the callers use "ferror()" to check for errors. Report write errors when printing dissections in Tethereal. Report print errors as errors, not warnings. svn path=/trunk/; revision=9828
Diffstat (limited to 'gtk/print_dlg.c')
-rw-r--r--gtk/print_dlg.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c
index b7a9ecc1c9..c08c686e25 100644
--- a/gtk/print_dlg.c
+++ b/gtk/print_dlg.c
@@ -1,7 +1,7 @@
/* print_dlg.c
* Dialog boxes for printing
*
- * $Id: print_dlg.c,v 1.56 2004/01/21 21:19:33 ulfl Exp $
+ * $Id: print_dlg.c,v 1.57 2004/01/25 00:58:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -26,6 +26,8 @@
#include "config.h"
#endif
+#include <string.h>
+
#include <gtk/gtk.h>
#include "globals.h"
@@ -833,13 +835,28 @@ print_ok_cb(GtkWidget *ok_bt, gpointer parent_w)
gtk_widget_destroy(GTK_WIDGET(parent_w));
/* Now print the packets */
- if (!print_packets(&cfile, &print_args)) {
+ switch (print_packets(&cfile, &print_args)) {
+
+ case PP_OK:
+ break;
+
+ case PP_OPEN_ERROR:
if (print_args.to_file)
- simple_dialog(ESD_TYPE_WARN, NULL,
- file_write_error_message(errno), print_args.dest);
+ simple_dialog(ESD_TYPE_CRIT, NULL,
+ file_open_error_message(errno, TRUE), print_args.dest);
else
- simple_dialog(ESD_TYPE_WARN, NULL, "Couldn't run print command %s.",
+ simple_dialog(ESD_TYPE_CRIT, NULL, "Couldn't run print command %s.",
print_args.dest);
+ break;
+
+ case PP_WRITE_ERROR:
+ if (print_args.to_file)
+ simple_dialog(ESD_TYPE_CRIT, NULL,
+ file_write_error_message(errno), print_args.dest);
+ else
+ simple_dialog(ESD_TYPE_CRIT, NULL,
+ "Error writing to print command: %s", strerror(errno));
+ break;
}
#ifdef _WIN32