case OPTION_FORMAT: /* GNU tar, others */
bsdtar->create_format = bsdtar->optarg;
break;
+ case OPTION_FORMAT_OPTIONS:
+ bsdtar->option_format_options = bsdtar->optarg;
+ break;
case 'f': /* SUSv2 */
bsdtar->filename = bsdtar->optarg;
if (strcmp(bsdtar->filename, "-") == 0)
char option_chroot; /* --chroot */
char option_dont_traverse_mounts; /* --one-file-system */
char option_fast_read; /* --fast-read */
+ const char *option_format_options; /* --format-options */
char option_honor_nodump; /* --nodump */
char option_interactive; /* -w */
char option_no_owner; /* -o */
OPTION_CHROOT,
OPTION_EXCLUDE,
OPTION_FORMAT,
+ OPTION_FORMAT_OPTIONS,
OPTION_HELP,
OPTION_INCLUDE,
OPTION_KEEP_NEWER_FILES,
{ "file", 1, 'f' },
{ "files-from", 1, 'T' },
{ "format", 1, OPTION_FORMAT },
+ { "format-options", 1, OPTION_FORMAT_OPTIONS },
{ "gunzip", 0, 'z' },
{ "gzip", 0, 'z' },
{ "help", 0, OPTION_HELP },
DEFAULT_BYTES_PER_BLOCK))
bsdtar_errc(bsdtar, 1, 0, "Error opening archive: %s",
archive_error_string(a));
+ if (bsdtar->option_format_options != NULL) {
+ r = archive_read_set_options(a, bsdtar->option_format_options);
+ if (r != ARCHIVE_OK)
+ bsdtar_errc(bsdtar, 1, 0, "Error archive options: %s",
+ archive_error_string(a));
+ }
do_chdir(bsdtar);
if (r != ARCHIVE_OK)
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
+ if (bsdtar->option_format_options != NULL) {
+ r = archive_write_set_options(a, bsdtar->option_format_options);
+ if (r != ARCHIVE_OK)
+ bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
+ }
+
write_archive(a, bsdtar);
}
}
lseek(bsdtar->fd, end_offset, SEEK_SET); /* XXX check return val XXX */
archive_write_open_fd(a, bsdtar->fd); /* XXX check return val XXX */
+ if (bsdtar->option_format_options != NULL) {
+ r = archive_write_set_options(a, bsdtar->option_format_options);
+ if (r != ARCHIVE_OK)
+ bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
+ }
write_archive(a, bsdtar); /* XXX check return val XXX */
int format;
struct archive_dir_entry *p;
struct archive_dir archive_dir;
+ int r;
bsdtar->archive_dir = &archive_dir;
memset(&archive_dir, 0, sizeof(archive_dir));
lseek(bsdtar->fd, end_offset, SEEK_SET);
ftruncate(bsdtar->fd, end_offset);
archive_write_open_fd(a, bsdtar->fd);
+ if (bsdtar->option_format_options != NULL) {
+ r = archive_write_set_options(a, bsdtar->option_format_options);
+ if (r != ARCHIVE_OK)
+ bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
+ }
write_archive(a, bsdtar);