]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add --ignore-zeros option to bsdtar 61/head
authorKevin Locke <kevin@kevinlocke.name>
Wed, 15 Jan 2014 03:05:40 +0000 (20:05 -0700)
committerKevin Locke <kevin@kevinlocke.name>
Wed, 15 Jan 2014 03:05:40 +0000 (20:05 -0700)
This option is an alias for --options read_concatenated_archive
introduced for compatibility with GNU tar.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
tar/bsdtar.1
tar/bsdtar.c
tar/bsdtar.h
tar/cmdline.c
tar/read.c

index b5ea142957b1505c10fcedd3cd7647e67acf20ff..b700e0584194424703ea7b899acfcfbb2ef4c7a6 100644 (file)
@@ -256,6 +256,10 @@ Show usage.
 .It Fl Fl hfsCompression
 (x mode only)
 Mac OS X specific(v10.6 or later). Compress extracted regular files with HFS+ compression.
+.It Fl Fl ignore-zeros
+An alias of
+.Fl Fl options Cm read_concatenated_archives
+for compatibility with GNU tar.
 .It Fl Fl include Ar pattern
 Process only files or directories that match the specified pattern.
 Note that exclusions specified with
index 888ba70a6c0c2dc8bb810f763f65942c54e5baab..205634dd670a6b7dd8ee1acecd4afdaa9efd7035 100644 (file)
@@ -339,6 +339,9 @@ main(int argc, char **argv)
                        bsdtar->extract_flags |=
                            ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED;
                        break;
+               case OPTION_IGNORE_ZEROS:
+                       bsdtar->option_ignore_zeros = 1;
+                       break;
                case 'I': /* GNU tar */
                        /*
                         * TODO: Allow 'names' to come from an archive,
index 637e1b9d4feee63a51aeb9c674f3a6469aacd73c..f8aae14cf1a96017baca0cdc194ad3ad99c699d5 100644 (file)
@@ -63,6 +63,7 @@ struct bsdtar {
        char              option_chroot; /* --chroot */
        char              option_fast_read; /* --fast-read */
        const char       *option_options; /* --options */
+       char              option_ignore_zeros; /* --ignore-zeros */
        char              option_interactive; /* -w */
        char              option_no_owner; /* -o */
        char              option_no_subdirs; /* -n */
@@ -124,6 +125,7 @@ enum {
        OPTION_GRZIP,
        OPTION_HELP,
        OPTION_HFS_COMPRESSION,
+       OPTION_IGNORE_ZEROS,
        OPTION_INCLUDE,
        OPTION_KEEP_NEWER_FILES,
        OPTION_LRZIP,
index 4444b80c558029d8bf520282d8fb3a981c749723..cb096865880955b7c15e0b0e2a220e8bbae48164 100644 (file)
@@ -94,6 +94,7 @@ static const struct bsdtar_option {
        { "gzip",                 0, 'z' },
        { "help",                 0, OPTION_HELP },
        { "hfsCompression",       0, OPTION_HFS_COMPRESSION },
+       { "ignore-zeros",         0, OPTION_IGNORE_ZEROS },
        { "include",              1, OPTION_INCLUDE },
        { "insecure",             0, 'P' },
        { "interactive",          0, 'w' },
index e2bacad9573c268d09188522ad1c75602b88437f..fdf34b887b6b0b0cebfe99ced2d1f61f60f87786 100644 (file)
@@ -201,6 +201,10 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer)
        }
        if (ARCHIVE_OK != archive_read_set_options(a, bsdtar->option_options))
                lafe_errc(1, 0, "%s", archive_error_string(a));
+       if (bsdtar->option_ignore_zeros)
+               if (archive_read_set_options(a,
+                   "read_concatenated_archives") != ARCHIVE_OK)
+                       lafe_errc(1, 0, "%s", archive_error_string(a));
        if (archive_read_open_filename(a, bsdtar->filename,
                                        bsdtar->bytes_per_block))
                lafe_errc(1, 0, "Error opening archive: %s",