Permalink
Browse files

Merge pull request #61 from kevinoid/ignore_zeros

Add --ignore-zeros option to bsdtar
  • Loading branch information...
kientzle committed Mar 16, 2014
2 parents ead037a + f52077a commit efb6bcb6b66b3c87468decfbe0be0aaa2b2cdac6
Showing with 14 additions and 0 deletions.
  1. +4 −0 tar/bsdtar.1
  2. +3 −0 tar/bsdtar.c
  3. +2 −0 tar/bsdtar.h
  4. +1 −0 tar/cmdline.c
  5. +4 −0 tar/read.c
View
@@ -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
View
@@ -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,
View
@@ -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,
View
@@ -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' },
View
@@ -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",

0 comments on commit efb6bcb

Please sign in to comment.