Merge remaining changes from libarchive.googlecode.com:
* Add xz and lzma compression options * Rename --format-options to simply --options * Add --same-owner for GNU tar compat * Add -lmd and -lcrypto to fix link * Documentation
This commit is contained in:
parent
f1f2531950
commit
4e8cb50d8b
@ -1,11 +1,11 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
PROG= bsdtar
|
PROG= bsdtar
|
||||||
BSDTAR_VERSION_STRING=2.6.901a
|
BSDTAR_VERSION_STRING=2.7.0
|
||||||
SRCS= bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c util.c write.c
|
SRCS= bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c util.c write.c
|
||||||
WARNS?= 5
|
WARNS?= 5
|
||||||
DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ}
|
DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ}
|
||||||
LDADD= -larchive -lbz2 -lz
|
LDADD= -larchive -lbz2 -lz -lmd -lcrypto
|
||||||
CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\"
|
CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\"
|
||||||
CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
|
CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\"
|
||||||
CFLAGS+= -I${.CURDIR}
|
CFLAGS+= -I${.CURDIR}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 15, 2008
|
.Dd March 25, 2009
|
||||||
.Dt BSDTAR 1
|
.Dt BSDTAR 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -37,12 +37,12 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Brq Fl c
|
.Brq Fl c
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
.Op Ar files | directories
|
.Op Ar files | Ar directories
|
||||||
.Nm
|
.Nm
|
||||||
.Brq Fl r | Fl u
|
.Brq Fl r | Fl u
|
||||||
.Fl f Ar archive-file
|
.Fl f Ar archive-file
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
.Op Ar files | directories
|
.Op Ar files | Ar directories
|
||||||
.Nm
|
.Nm
|
||||||
.Brq Fl t | Fl x
|
.Brq Fl t | Fl x
|
||||||
.Op Ar options
|
.Op Ar options
|
||||||
@ -305,6 +305,64 @@ A synonym for
|
|||||||
.It Fl -one-file-system
|
.It Fl -one-file-system
|
||||||
(c, r, and u modes)
|
(c, r, and u modes)
|
||||||
Do not cross mount points.
|
Do not cross mount points.
|
||||||
|
.It Fl -options Ar options
|
||||||
|
Select optional behaviors for particular modules.
|
||||||
|
The argument is a text string containing comma-separated
|
||||||
|
keywords and values.
|
||||||
|
These are passed to the modules that handle particular
|
||||||
|
formats to control how those formats will behave.
|
||||||
|
Each option has one of the following forms:
|
||||||
|
.Bl -tag -compact -width indent
|
||||||
|
.It Ar key=value
|
||||||
|
The key will be set to the specified value in every module that supports it.
|
||||||
|
Modules that do not support this key will ignore it.
|
||||||
|
.It Ar key
|
||||||
|
The key will be enabled in every module that supports it.
|
||||||
|
This is equivalent to
|
||||||
|
.Ar key Ns Cm =1 .
|
||||||
|
.It Ar !key
|
||||||
|
The key will be disabled in every module that supports it.
|
||||||
|
.It Ar module:key=value , Ar module:key , Ar module:!key
|
||||||
|
As above, but the corresponding key and value will be provided
|
||||||
|
only to modules whose name matches
|
||||||
|
.Ar module .
|
||||||
|
.El
|
||||||
|
The currently supported modules and keys are:
|
||||||
|
.Bl -tag -compact -width indent
|
||||||
|
.It Cm iso9660:joliet
|
||||||
|
Support Joliet extensions.
|
||||||
|
This is enabled by default, use
|
||||||
|
.Cm !joliet
|
||||||
|
or
|
||||||
|
.Cm iso9660:!joliet
|
||||||
|
to disable.
|
||||||
|
.It Cm gzip:compression-level
|
||||||
|
A decimal integer from 0 to 9 specifying the gzip compression level.
|
||||||
|
.It Cm xz:compression-level
|
||||||
|
A decimal integer from 0 to 9 specifying the xz compression level.
|
||||||
|
.It Cm mtree: Ns Ar keyword
|
||||||
|
The mtree writer module allows you to specify which mtree keywords
|
||||||
|
will be included in the output.
|
||||||
|
Supported keywords include:
|
||||||
|
.Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent ,
|
||||||
|
.Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 ,
|
||||||
|
.Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname .
|
||||||
|
The default is equivalent to:
|
||||||
|
.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
|
||||||
|
.It Cm mtree:all
|
||||||
|
Enables all of the above keywords.
|
||||||
|
You can also use
|
||||||
|
.Cm mtree:!all
|
||||||
|
to disable all keywords.
|
||||||
|
.It Cm mtree:use-set
|
||||||
|
Enable generation of
|
||||||
|
.Cm /set
|
||||||
|
lines in the output.
|
||||||
|
.It Cm mtree:indent
|
||||||
|
XXX need explanation XXX
|
||||||
|
.El
|
||||||
|
If a provided option is not supported by any module, that
|
||||||
|
is a fatal error.
|
||||||
.It Fl P
|
.It Fl P
|
||||||
Preserve pathnames.
|
Preserve pathnames.
|
||||||
By default, absolute pathnames (those that begin with a /
|
By default, absolute pathnames (those that begin with a /
|
||||||
@ -555,6 +613,27 @@ switches accept a variety of common date and time specifications, including
|
|||||||
.Dq 5 minutes ago ,
|
.Dq 5 minutes ago ,
|
||||||
and
|
and
|
||||||
.Dq 19:14 PST May 1 .
|
.Dq 19:14 PST May 1 .
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
|
.Fl -options
|
||||||
|
argument can be used to control various details of archive generation
|
||||||
|
or reading.
|
||||||
|
For example, you can generate mtree output which only contains
|
||||||
|
.Cm type , Cm time ,
|
||||||
|
and
|
||||||
|
.Cm uid
|
||||||
|
keywords:
|
||||||
|
.Dl Nm Fl cf Pa file.tar Fl -format=mtree Fl -options='!all,type,time,uid' Pa dir
|
||||||
|
or you can set the compression level used by gzip or xz compression:
|
||||||
|
.Dl Nm Fl czf Pa file.tar Fl -options='compression-level=9' .
|
||||||
|
For more details, see the explanation of the
|
||||||
|
.Fn archive_read_set_options
|
||||||
|
and
|
||||||
|
.Fn archive_write_set_options
|
||||||
|
API calls that are described in
|
||||||
|
.Xr archive_read 3
|
||||||
|
and
|
||||||
|
.Xr archive_write 3 .
|
||||||
.Sh COMPATIBILITY
|
.Sh COMPATIBILITY
|
||||||
The bundled-arguments format is supported for compatibility
|
The bundled-arguments format is supported for compatibility
|
||||||
with historic implementations.
|
with historic implementations.
|
||||||
|
@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#ifdef __linux
|
#ifdef __linux
|
||||||
#define _PATH_DEFTAPE "/dev/st0"
|
#define _PATH_DEFTAPE "/dev/st0"
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#define _PATH_DEFTAPE "\\\\.\\tape0"
|
#define _PATH_DEFTAPE "\\\\.\\tape0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -113,8 +113,10 @@ main(int argc, char **argv)
|
|||||||
memset(bsdtar, 0, sizeof(*bsdtar));
|
memset(bsdtar, 0, sizeof(*bsdtar));
|
||||||
bsdtar->fd = -1; /* Mark as "unused" */
|
bsdtar->fd = -1; /* Mark as "unused" */
|
||||||
option_o = 0;
|
option_o = 0;
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
/* Make sure open() function will be used with a binary mode. */
|
/* Make sure open() function will be used with a binary mode. */
|
||||||
|
/* on cygwin, we need something similar, but instead link against */
|
||||||
|
/* a special startup object, binmode.o */
|
||||||
_set_fmode(_O_BINARY);
|
_set_fmode(_O_BINARY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -122,7 +124,7 @@ main(int argc, char **argv)
|
|||||||
if (*argv == NULL)
|
if (*argv == NULL)
|
||||||
bsdtar->progname = "bsdtar";
|
bsdtar->progname = "bsdtar";
|
||||||
else {
|
else {
|
||||||
#if _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
bsdtar->progname = strrchr(*argv, '\\');
|
bsdtar->progname = strrchr(*argv, '\\');
|
||||||
#else
|
#else
|
||||||
bsdtar->progname = strrchr(*argv, '/');
|
bsdtar->progname = strrchr(*argv, '/');
|
||||||
@ -166,10 +168,6 @@ main(int argc, char **argv)
|
|||||||
bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR;
|
bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR;
|
||||||
bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
|
bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
|
||||||
/* Windows cannot set UNIX like uid/gid. */
|
|
||||||
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bsdtar->argv = argv;
|
bsdtar->argv = argv;
|
||||||
bsdtar->argc = argc;
|
bsdtar->argc = argc;
|
||||||
@ -212,8 +210,8 @@ main(int argc, char **argv)
|
|||||||
case OPTION_FORMAT: /* GNU tar, others */
|
case OPTION_FORMAT: /* GNU tar, others */
|
||||||
bsdtar->create_format = bsdtar->optarg;
|
bsdtar->create_format = bsdtar->optarg;
|
||||||
break;
|
break;
|
||||||
case OPTION_FORMAT_OPTIONS:
|
case OPTION_OPTIONS:
|
||||||
bsdtar->option_format_options = bsdtar->optarg;
|
bsdtar->option_options = bsdtar->optarg;
|
||||||
break;
|
break;
|
||||||
case 'f': /* SUSv2 */
|
case 'f': /* SUSv2 */
|
||||||
bsdtar->filename = bsdtar->optarg;
|
bsdtar->filename = bsdtar->optarg;
|
||||||
@ -267,6 +265,19 @@ main(int argc, char **argv)
|
|||||||
bsdtar_warnc(bsdtar, 0,
|
bsdtar_warnc(bsdtar, 0,
|
||||||
"bzip2 compression not supported by this version of bsdtar");
|
"bzip2 compression not supported by this version of bsdtar");
|
||||||
usage(bsdtar);
|
usage(bsdtar);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 'J': /* GNU tar 1.21 and later */
|
||||||
|
#if HAVE_LIBLZMA
|
||||||
|
if (bsdtar->create_compression != '\0')
|
||||||
|
bsdtar_errc(bsdtar, 1, 0,
|
||||||
|
"Can't specify both -%c and -%c", opt,
|
||||||
|
bsdtar->create_compression);
|
||||||
|
bsdtar->create_compression = opt;
|
||||||
|
#else
|
||||||
|
bsdtar_warnc(bsdtar, 0,
|
||||||
|
"xz compression not supported by this version of bsdtar");
|
||||||
|
usage(bsdtar);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'k': /* GNU tar */
|
case 'k': /* GNU tar */
|
||||||
@ -282,6 +293,19 @@ main(int argc, char **argv)
|
|||||||
/* GNU tar 1.13 used -l for --one-file-system */
|
/* GNU tar 1.13 used -l for --one-file-system */
|
||||||
bsdtar->option_warn_links = 1;
|
bsdtar->option_warn_links = 1;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_LZMA:
|
||||||
|
#if HAVE_LIBLZMA
|
||||||
|
if (bsdtar->create_compression != '\0')
|
||||||
|
bsdtar_errc(bsdtar, 1, 0,
|
||||||
|
"Can't specify both -%c and -%c", opt,
|
||||||
|
bsdtar->create_compression);
|
||||||
|
bsdtar->create_compression = opt;
|
||||||
|
#else
|
||||||
|
bsdtar_warnc(bsdtar, 0,
|
||||||
|
"lzma compression not supported by this version of bsdtar");
|
||||||
|
usage(bsdtar);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
case 'm': /* SUSv2 */
|
case 'm': /* SUSv2 */
|
||||||
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_TIME;
|
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_TIME;
|
||||||
break;
|
break;
|
||||||
@ -392,6 +416,9 @@ main(int argc, char **argv)
|
|||||||
usage(bsdtar);
|
usage(bsdtar);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case OPTION_SAME_OWNER: /* GNU tar */
|
||||||
|
bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER;
|
||||||
|
break;
|
||||||
case OPTION_STRIP_COMPONENTS: /* GNU tar 1.15 */
|
case OPTION_STRIP_COMPONENTS: /* GNU tar 1.15 */
|
||||||
bsdtar->strip_components = atoi(bsdtar->optarg);
|
bsdtar->strip_components = atoi(bsdtar->optarg);
|
||||||
break;
|
break;
|
||||||
@ -632,7 +659,7 @@ static const char *long_help_msg =
|
|||||||
" -w Interactive\n"
|
" -w Interactive\n"
|
||||||
"Create: %p -c [options] [<file> | <dir> | @<archive> | -C <dir> ]\n"
|
"Create: %p -c [options] [<file> | <dir> | @<archive> | -C <dir> ]\n"
|
||||||
" <file>, <dir> add these items to archive\n"
|
" <file>, <dir> add these items to archive\n"
|
||||||
" -z, -j Compress archive with gzip/bzip2\n"
|
" -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma\n"
|
||||||
" --format {ustar|pax|cpio|shar} Select archive format\n"
|
" --format {ustar|pax|cpio|shar} Select archive format\n"
|
||||||
" --exclude <pattern> Skip files that match pattern\n"
|
" --exclude <pattern> Skip files that match pattern\n"
|
||||||
" -C <dir> Change to <dir> before processing remaining files\n"
|
" -C <dir> Change to <dir> before processing remaining files\n"
|
||||||
|
@ -60,7 +60,7 @@ struct bsdtar {
|
|||||||
char option_chroot; /* --chroot */
|
char option_chroot; /* --chroot */
|
||||||
char option_dont_traverse_mounts; /* --one-file-system */
|
char option_dont_traverse_mounts; /* --one-file-system */
|
||||||
char option_fast_read; /* --fast-read */
|
char option_fast_read; /* --fast-read */
|
||||||
const char *option_format_options; /* --format-options */
|
const char *option_options; /* --options */
|
||||||
char option_honor_nodump; /* --nodump */
|
char option_honor_nodump; /* --nodump */
|
||||||
char option_interactive; /* -w */
|
char option_interactive; /* -w */
|
||||||
char option_no_owner; /* -o */
|
char option_no_owner; /* -o */
|
||||||
@ -111,10 +111,11 @@ enum {
|
|||||||
OPTION_CHROOT,
|
OPTION_CHROOT,
|
||||||
OPTION_EXCLUDE,
|
OPTION_EXCLUDE,
|
||||||
OPTION_FORMAT,
|
OPTION_FORMAT,
|
||||||
OPTION_FORMAT_OPTIONS,
|
OPTION_OPTIONS,
|
||||||
OPTION_HELP,
|
OPTION_HELP,
|
||||||
OPTION_INCLUDE,
|
OPTION_INCLUDE,
|
||||||
OPTION_KEEP_NEWER_FILES,
|
OPTION_KEEP_NEWER_FILES,
|
||||||
|
OPTION_LZMA,
|
||||||
OPTION_NEWER_CTIME,
|
OPTION_NEWER_CTIME,
|
||||||
OPTION_NEWER_CTIME_THAN,
|
OPTION_NEWER_CTIME_THAN,
|
||||||
OPTION_NEWER_MTIME,
|
OPTION_NEWER_MTIME,
|
||||||
@ -126,6 +127,7 @@ enum {
|
|||||||
OPTION_NUMERIC_OWNER,
|
OPTION_NUMERIC_OWNER,
|
||||||
OPTION_ONE_FILE_SYSTEM,
|
OPTION_ONE_FILE_SYSTEM,
|
||||||
OPTION_POSIX,
|
OPTION_POSIX,
|
||||||
|
OPTION_SAME_OWNER,
|
||||||
OPTION_STRIP_COMPONENTS,
|
OPTION_STRIP_COMPONENTS,
|
||||||
OPTION_TOTALS,
|
OPTION_TOTALS,
|
||||||
OPTION_USE_COMPRESS_PROGRAM,
|
OPTION_USE_COMPRESS_PROGRAM,
|
||||||
|
@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
* Short options for tar. Please keep this sorted.
|
* Short options for tar. Please keep this sorted.
|
||||||
*/
|
*/
|
||||||
static const char *short_options
|
static const char *short_options
|
||||||
= "Bb:C:cf:HhI:jkLlmnOoPpqrSs:T:tUuvW:wX:xyZz";
|
= "Bb:C:cf:HhI:JjkLlmnOoPpqrSs:T:tUuvW:wX:xyZz";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Long options for tar. Please keep this list sorted.
|
* Long options for tar. Please keep this list sorted.
|
||||||
@ -83,7 +83,7 @@ static struct option {
|
|||||||
{ "file", 1, 'f' },
|
{ "file", 1, 'f' },
|
||||||
{ "files-from", 1, 'T' },
|
{ "files-from", 1, 'T' },
|
||||||
{ "format", 1, OPTION_FORMAT },
|
{ "format", 1, OPTION_FORMAT },
|
||||||
{ "format-options", 1, OPTION_FORMAT_OPTIONS },
|
{ "options", 1, OPTION_OPTIONS },
|
||||||
{ "gunzip", 0, 'z' },
|
{ "gunzip", 0, 'z' },
|
||||||
{ "gzip", 0, 'z' },
|
{ "gzip", 0, 'z' },
|
||||||
{ "help", 0, OPTION_HELP },
|
{ "help", 0, OPTION_HELP },
|
||||||
@ -93,6 +93,7 @@ static struct option {
|
|||||||
{ "keep-newer-files", 0, OPTION_KEEP_NEWER_FILES },
|
{ "keep-newer-files", 0, OPTION_KEEP_NEWER_FILES },
|
||||||
{ "keep-old-files", 0, 'k' },
|
{ "keep-old-files", 0, 'k' },
|
||||||
{ "list", 0, 't' },
|
{ "list", 0, 't' },
|
||||||
|
{ "lzma", 0, OPTION_LZMA },
|
||||||
{ "modification-time", 0, 'm' },
|
{ "modification-time", 0, 'm' },
|
||||||
{ "newer", 1, OPTION_NEWER_CTIME },
|
{ "newer", 1, OPTION_NEWER_CTIME },
|
||||||
{ "newer-ctime", 1, OPTION_NEWER_CTIME },
|
{ "newer-ctime", 1, OPTION_NEWER_CTIME },
|
||||||
@ -111,6 +112,7 @@ static struct option {
|
|||||||
{ "posix", 0, OPTION_POSIX },
|
{ "posix", 0, OPTION_POSIX },
|
||||||
{ "preserve-permissions", 0, 'p' },
|
{ "preserve-permissions", 0, 'p' },
|
||||||
{ "read-full-blocks", 0, 'B' },
|
{ "read-full-blocks", 0, 'B' },
|
||||||
|
{ "same-owner", 0, OPTION_SAME_OWNER },
|
||||||
{ "same-permissions", 0, 'p' },
|
{ "same-permissions", 0, 'p' },
|
||||||
{ "strip-components", 1, OPTION_STRIP_COMPONENTS },
|
{ "strip-components", 1, OPTION_STRIP_COMPONENTS },
|
||||||
{ "to-stdout", 0, 'O' },
|
{ "to-stdout", 0, 'O' },
|
||||||
@ -122,6 +124,7 @@ static struct option {
|
|||||||
{ "use-compress-program", 1, OPTION_USE_COMPRESS_PROGRAM },
|
{ "use-compress-program", 1, OPTION_USE_COMPRESS_PROGRAM },
|
||||||
{ "verbose", 0, 'v' },
|
{ "verbose", 0, 'v' },
|
||||||
{ "version", 0, OPTION_VERSION },
|
{ "version", 0, OPTION_VERSION },
|
||||||
|
{ "xz", 0, 'J' },
|
||||||
{ NULL, 0, 0 }
|
{ NULL, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,6 +189,14 @@ tar_mode_c(struct bsdtar *bsdtar)
|
|||||||
archive_write_set_compression_bzip2(a);
|
archive_write_set_compression_bzip2(a);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LIBLZMA
|
||||||
|
case 'J':
|
||||||
|
archive_write_set_compression_xz(a);
|
||||||
|
break;
|
||||||
|
case OPTION_LZMA:
|
||||||
|
archive_write_set_compression_lzma(a);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
case 'z':
|
case 'z':
|
||||||
archive_write_set_compression_gzip(a);
|
archive_write_set_compression_gzip(a);
|
||||||
@ -204,16 +212,10 @@ tar_mode_c(struct bsdtar *bsdtar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = archive_write_open_file(a, bsdtar->filename);
|
if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
|
||||||
if (r != ARCHIVE_OK)
|
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
||||||
|
if (ARCHIVE_OK != archive_write_open_file(a, bsdtar->filename))
|
||||||
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
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);
|
write_archive(a, bsdtar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,12 +301,10 @@ tar_mode_r(struct bsdtar *bsdtar)
|
|||||||
archive_write_set_format(a, format);
|
archive_write_set_format(a, format);
|
||||||
}
|
}
|
||||||
lseek(bsdtar->fd, end_offset, SEEK_SET); /* XXX check return val XXX */
|
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 (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
|
||||||
if (bsdtar->option_format_options != NULL) {
|
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
||||||
r = archive_write_set_options(a, bsdtar->option_format_options);
|
if (ARCHIVE_OK != archive_write_open_fd(a, bsdtar->fd))
|
||||||
if (r != ARCHIVE_OK)
|
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
||||||
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
write_archive(a, bsdtar); /* XXX check return val XXX */
|
write_archive(a, bsdtar); /* XXX check return val XXX */
|
||||||
|
|
||||||
@ -321,7 +321,6 @@ tar_mode_u(struct bsdtar *bsdtar)
|
|||||||
int format;
|
int format;
|
||||||
struct archive_dir_entry *p;
|
struct archive_dir_entry *p;
|
||||||
struct archive_dir archive_dir;
|
struct archive_dir archive_dir;
|
||||||
int r;
|
|
||||||
|
|
||||||
bsdtar->archive_dir = &archive_dir;
|
bsdtar->archive_dir = &archive_dir;
|
||||||
memset(&archive_dir, 0, sizeof(archive_dir));
|
memset(&archive_dir, 0, sizeof(archive_dir));
|
||||||
@ -385,12 +384,10 @@ tar_mode_u(struct bsdtar *bsdtar)
|
|||||||
archive_write_set_bytes_per_block(a, DEFAULT_BYTES_PER_BLOCK);
|
archive_write_set_bytes_per_block(a, DEFAULT_BYTES_PER_BLOCK);
|
||||||
lseek(bsdtar->fd, end_offset, SEEK_SET);
|
lseek(bsdtar->fd, end_offset, SEEK_SET);
|
||||||
ftruncate(bsdtar->fd, end_offset);
|
ftruncate(bsdtar->fd, end_offset);
|
||||||
archive_write_open_fd(a, bsdtar->fd);
|
if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
|
||||||
if (bsdtar->option_format_options != NULL) {
|
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
||||||
r = archive_write_set_options(a, bsdtar->option_format_options);
|
if (ARCHIVE_OK != archive_write_open_fd(a, bsdtar->fd))
|
||||||
if (r != ARCHIVE_OK)
|
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
||||||
bsdtar_errc(bsdtar, 1, 0, archive_error_string(a));
|
|
||||||
}
|
|
||||||
|
|
||||||
write_archive(a, bsdtar);
|
write_archive(a, bsdtar);
|
||||||
|
|
||||||
@ -457,7 +454,7 @@ write_archive(struct archive *a, struct bsdtar *bsdtar)
|
|||||||
arg + 1) != 0)
|
arg + 1) != 0)
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
write_hierarchy_win(bsdtar, a, arg,
|
write_hierarchy_win(bsdtar, a, arg,
|
||||||
write_hierarchy);
|
write_hierarchy);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user