summaryrefslogtreecommitdiff
path: root/cat/bsdcat.c
diff options
context:
space:
mode:
authorMike Kazantsev <mk.fraggod@gmail.com>2014-04-06 04:40:40 +0600
committerfraggod@sacrilege <mk.fraggod@gmail.com>2014-04-06 04:44:34 +0600
commitc1628626209899fa841c2befd8fedb97fe182b67 (patch)
tree1b45d6137dbf588497eab04a6ee5cc9dcaa29a38 /cat/bsdcat.c
parent30e772e086d42949c6da8bda4e2e6a099f5075a8 (diff)
downloadlibarchive-c1628626209899fa841c2befd8fedb97fe182b67.tar.gz
Change bsdcat behavior to process as many files as possible.
Change is to match "cat" behavior of printing any errors (e.g. "unable to open file") and continue to the next file instead of exiting on first error encountered.
Diffstat (limited to 'cat/bsdcat.c')
-rw-r--r--cat/bsdcat.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/cat/bsdcat.c b/cat/bsdcat.c
index c453201a..46eadfa0 100644
--- a/cat/bsdcat.c
+++ b/cat/bsdcat.c
@@ -65,17 +65,21 @@ bsdcat_next()
}
void
+bsdcat_print_error(void)
+{
+ lafe_warnc(0, "%s: %s",
+ bsdcat_current_path, archive_error_string(a));
+}
+
+void
bsdcat_read_to_stdout(char* filename)
{
if ((archive_read_open_filename(a, filename, BYTES_PER_BLOCK) != ARCHIVE_OK)
|| (archive_read_next_header(a, &ae) != ARCHIVE_OK)
- || (archive_read_data_into_fd(a, 1) != ARCHIVE_OK)
- || (archive_read_free(a) != ARCHIVE_OK))
- goto fail;
- return;
-fail:
- lafe_errc(1, 0, "Error: %s - %s",
- bsdcat_current_path, archive_error_string(a));
+ || (archive_read_data_into_fd(a, 1) != ARCHIVE_OK))
+ bsdcat_print_error();
+ if (archive_read_free(a) != ARCHIVE_OK)
+ bsdcat_print_error();
}
int