From: Bjoern Jacke Date: Mon, 28 Dec 2015 11:58:16 +0000 (+0100) Subject: bsdtar: add support for "vv" verbose style when writing archives X-Git-Tag: v3.1.901a~9^2~6^2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=220d587cd6765e664873ed50e899e5964b88344f;p=thirdparty%2Flibarchive.git bsdtar: add support for "vv" verbose style when writing archives --- diff --git a/tar/write.c b/tar/write.c index beaf98a0b..53b63834c 100644 --- a/tar/write.c +++ b/tar/write.c @@ -694,7 +694,10 @@ append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina) if (bsdtar->option_interactive && !yes("copy '%s'", archive_entry_pathname(in_entry))) continue; - if (bsdtar->verbose) + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, in_entry); + } else if (bsdtar->verbose > 0) safe_fprintf(stderr, "a %s", archive_entry_pathname(in_entry)); if (need_report()) @@ -914,11 +917,15 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) if (edit_pathname(bsdtar, entry)) continue; - /* Display entry as we process it. - * This format is required by SUSv2. */ - if (bsdtar->verbose) + /* Display entry as we process it. */ + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, entry); + } else if (bsdtar->verbose > 0) { + /* This format is required by SUSv2. */ safe_fprintf(stderr, "a %s", archive_entry_pathname(entry)); + } /* Non-regular files get archived with zero size. */ if (archive_entry_filetype(entry) != AE_IFREG) @@ -962,11 +969,15 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, e = archive_write_header(a, entry); if (e != ARCHIVE_OK) { - if (!bsdtar->verbose) + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, entry); + lafe_warnc(0, ": %s", archive_error_string(a)); + } else if (bsdtar->verbose > 0) { lafe_warnc(0, "%s: %s", archive_entry_pathname(entry), archive_error_string(a)); - else + } else fprintf(stderr, ": %s", archive_error_string(a)); }