From: Kevin Locke Date: Wed, 15 Jan 2014 03:05:40 +0000 (-0700) Subject: Add --ignore-zeros option to bsdtar X-Git-Tag: v3.1.900a~312^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F61%2Fhead;p=thirdparty%2Flibarchive.git Add --ignore-zeros option to bsdtar This option is an alias for --options read_concatenated_archive introduced for compatibility with GNU tar. Signed-off-by: Kevin Locke --- diff --git a/tar/bsdtar.1 b/tar/bsdtar.1 index b5ea14295..b700e0584 100644 --- a/tar/bsdtar.1 +++ b/tar/bsdtar.1 @@ -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 diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 888ba70a6..205634dd6 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -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, diff --git a/tar/bsdtar.h b/tar/bsdtar.h index 637e1b9d4..f8aae14cf 100644 --- a/tar/bsdtar.h +++ b/tar/bsdtar.h @@ -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, diff --git a/tar/cmdline.c b/tar/cmdline.c index 4444b80c5..cb0968658 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -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' }, diff --git a/tar/read.c b/tar/read.c index e2bacad95..fdf34b887 100644 --- a/tar/read.c +++ b/tar/read.c @@ -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",