]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
bsdtar: add support for "vv" verbose style when writing archives
authorBjoern Jacke <bjoern@j3e.de>
Mon, 28 Dec 2015 11:58:16 +0000 (12:58 +0100)
committerBjörn Jacke <bj@sernet.de>
Fri, 5 Feb 2016 16:53:53 +0000 (17:53 +0100)
tar/write.c

index beaf98a0b4368ac60b329584286a5eecc7836ecc..53b63834c419a7ec949120c907cfafff3e08b34c 100644 (file)
@@ -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));
        }