diff options
author | Martin Matuska <martin@matuska.org> | 2017-02-22 21:39:48 +0100 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2017-02-23 00:28:20 +0100 |
commit | 6a9dcf9fc429e2dc9fb08e669bf7b0bed4d5edf9 (patch) | |
tree | 853551ff1af468256c75dff89049f80ea697172c /tar/read.c | |
parent | 4b7779df5d812d735a5367b66ccb2395682049e8 (diff) | |
download | libarchive-6a9dcf9fc429e2dc9fb08e669bf7b0bed4d5edf9.tar.gz |
tar: use option_flags bitfield for boolean options
Diffstat (limited to 'tar/read.c')
-rw-r--r-- | tar/read.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -105,7 +105,7 @@ tar_mode_x(struct bsdtar *bsdtar) writer = archive_write_disk_new(); if (writer == NULL) lafe_errc(1, ENOMEM, "Cannot allocate disk writer object"); - if (!bsdtar->option_numeric_owner) + if ((bsdtar->flags & OPTFLAG_NUMERIC_OWNER) == 0) archive_write_disk_set_standard_lookup(writer); archive_write_disk_set_options(writer, bsdtar->extract_flags); @@ -177,7 +177,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (bsdtar->names_from_file != NULL) if (archive_match_include_pattern_from_file( bsdtar->matching, bsdtar->names_from_file, - bsdtar->option_null) != ARCHIVE_OK) + (bsdtar->flags & OPTFLAG_NULL)) != ARCHIVE_OK) lafe_errc(1, 0, "Error inclusion pattern: %s", archive_error_string(bsdtar->matching)); @@ -208,7 +208,7 @@ 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 (bsdtar->flags & OPTFLAG_IGNORE_ZEROS) if (archive_read_set_options(a, "read_concatenated_archives") != ARCHIVE_OK) lafe_errc(1, 0, "%s", archive_error_string(a)); @@ -234,7 +234,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) &progress_data); } - if (mode == 'x' && bsdtar->option_chroot) { + if (mode == 'x' && (bsdtar->flags & OPTFLAG_CHROOT)) { #if HAVE_CHROOT if (chroot(".") != 0) lafe_errc(1, errno, "Can't chroot to \".\""); @@ -245,7 +245,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } #if defined(_WIN32) && !defined(__CYGWIN__) - if (mode == 'x' && bsdtar->option_stdout) { + if (mode == 'x' && (bsdtar->flags & OPTFLAG_STDOUT)) { _setmode(1, _O_BINARY); } #endif @@ -253,7 +253,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) for (;;) { /* Support --fast-read option */ const char *p; - if (bsdtar->option_fast_read && + if ((bsdtar->flags & OPTFLAG_FAST_READ) && archive_match_path_unmatched_inclusions(bsdtar->matching) == 0) break; @@ -307,7 +307,8 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (mode == 't') { /* Perversely, gtar uses -O to mean "send to stderr" * when used with -t. */ - out = bsdtar->option_stdout ? stderr : stdout; + out = (bsdtar->flags & OPTFLAG_STDOUT) ? + stderr : stdout; /* * TODO: Provide some reasonable way to @@ -345,7 +346,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (edit_pathname(bsdtar, entry)) continue; /* Excluded by a rewrite failure. */ - if (bsdtar->option_interactive && + if ((bsdtar->flags & OPTFLAG_INTERACTIVE) && !yes("extract '%s'", archive_entry_pathname(entry))) continue; @@ -364,7 +365,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) /* TODO siginfo_printinfo(bsdtar, 0); */ - if (bsdtar->option_stdout) + if (bsdtar->flags & OPTFLAG_STDOUT) r = archive_read_data_into_fd(a, 1); else r = archive_read_extract2(a, entry, writer); |