aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-10-27 23:28:37 +0000
committerGuy Harris <guy@alum.mit.edu>2004-10-27 23:28:37 +0000
commitb48b8847b1ac3289656224831f86a5d235202455 (patch)
tree710dc8246082edefe1ea5a819d05276fdfb80d8e /file.c
parent21e7c6bc78dd27c84e4eec6470c2fb5084f35c56 (diff)
Change some of the merge.c APIs to return more information on failure,
and use that information to provide better error messages. Have "merge_open_outfile()" do all the work of filling in the merge_out_file_t structure, with the values to use passed as arguments. Get rid of some structure members that used to be used solely to pass information to "merge_open_outfile()". Add a "cf_merge_files()" routine to do the merging and reporting of errors. svn path=/trunk/; revision=12420
Diffstat (limited to 'file.c')
-rw-r--r--file.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/file.c b/file.c
index c4b6a0c570..f7c3f1b71d 100644
--- a/file.c
+++ b/file.c
@@ -75,6 +75,7 @@
#include "file.h"
#include "menu.h"
#include "util.h"
+#include "merge.h"
#include "alert_box.h"
#include "simple_dialog.h"
#include "progress_dlg.h"
@@ -968,6 +969,40 @@ read_packet(capture_file *cf, long offset)
}
gboolean
+cf_merge_files(const char *out_file, int out_fd, int in_file_count,
+ char *const *in_filenames, int filetype, gboolean do_append)
+{
+ merge_status_e merge_status;
+ int err;
+ gchar *err_info;
+ int err_fileno;
+
+ merge_status = merge_n_files(out_fd, in_file_count, in_filenames, filetype,
+ do_append, &err, &err_info, &err_fileno);
+
+ switch (merge_status) {
+
+ case MERGE_SUCCESS:
+ return TRUE;
+
+ case MERGE_OPEN_INPUT_FAILED:
+ cf_open_failure_alert_box(in_filenames[err_fileno], err, err_info, FALSE, 0);
+ return FALSE;
+
+ case MERGE_OPEN_OUTPUT_FAILED:
+ cf_open_failure_alert_box(out_file, err, err_info, TRUE, filetype);
+ return FALSE;
+
+ /* XXX - what about read failures? */
+
+ case MERGE_WRITE_FAILED:
+ cf_write_failure_alert_box(out_file, err);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean
filter_packets(capture_file *cf, gchar *dftext, gboolean force)
{
dfilter_t *dfcode;