New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --ignore-zeros option to bsdtar #61

Merged
merged 1 commit into from Mar 16, 2014
Jump to file or symbol
Failed to load files and symbols.
+14 −0
Diff settings

Always

Just for now

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 */

This comment has been minimized.

@kientzle

kientzle Jan 16, 2014

Contributor

Yes, this should really be fixed. It should be possible, for instance, to specify --options more than once and get all the accumulated options. If we do that, we can implement --ignore-zeros the right way.

That might mean changing this to a linked list so we can add separate strings. It might be enough to make it a fixed array of 20 or 50 entries. But just one entry is clearly not enough.

@kientzle

kientzle Jan 16, 2014

Contributor

Yes, this should really be fixed. It should be possible, for instance, to specify --options more than once and get all the accumulated options. If we do that, we can implement --ignore-zeros the right way.

That might mean changing this to a linked list so we can add separate strings. It might be enough to make it a fixed array of 20 or 50 entries. But just one entry is clearly not enough.

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",
ProTip! Use n and p to navigate between commits in a pull request.