tar/test/test_option_gid_gname.c \
tar/test/test_option_k.c \
tar/test/test_option_keep_newer_files.c \
+ tar/test/test_option_lrzip.c \
tar/test/test_option_lzma.c \
tar/test/test_option_lzop.c \
tar/test/test_option_n.c \
cpio/test/test_option_f.c \
cpio/test/test_option_help.c \
cpio/test/test_option_l.c \
+ cpio/test/test_option_lrzip.c \
cpio/test/test_option_lzma.c \
cpio/test/test_option_lzop.c \
cpio/test/test_option_m.c \
(p mode only)
Create links from the target directory to the original files,
instead of copying.
+.It Fl Fl lrzip
+(o mode only)
+Compress the resulting archive with
+.Xr lrzip 1 .
+In input mode, this option is ignored.
.It Fl Fl lzma
(o mode only)
Compress the file with lzma-compatible compression before writing it.
{ "insecure", 0, OPTION_INSECURE },
{ "link", 0, 'l' },
{ "list", 0, 't' },
+ { "lrzip", 0, OPTION_LRZIP },
{ "lzma", 0, OPTION_LZMA },
{ "lzop", 0, OPTION_LZOP },
{ "make-directories", 0, 'd' },
case 'l': /* POSIX 1997 */
cpio->option_link = 1;
break;
+ case OPTION_LRZIP:
case OPTION_LZMA: /* GNU tar, others */
case OPTION_LZOP: /* GNU tar, others */
cpio->compress = opt;
case 'J':
r = archive_write_set_compression_xz(cpio->archive);
break;
+ case OPTION_LRZIP:
+ r = archive_write_add_filter_lrzip(cpio->archive);
+ break;
case OPTION_LZMA:
r = archive_write_set_compression_lzma(cpio->archive);
break;
/* Fake short equivalents for long options that otherwise lack them. */
enum {
OPTION_INSECURE = 1,
+ OPTION_LRZIP,
OPTION_LZMA,
OPTION_LZOP,
OPTION_NO_PRESERVE_OWNER,
test_option_f.c
test_option_help.c
test_option_l.c
+ test_option_lrzip.c
test_option_lzma.c
test_option_lzop.c
test_option_m.c
--- /dev/null
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2012 Michihiro NAKAJIMA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_option_lrzip)
+{
+ char *p;
+ size_t s;
+
+ if (!canLrzip()) {
+ skipping("lrzip is not supported on this platform");
+ return;
+ }
+
+ /* Create a file. */
+ assertMakeFile("f", 0644, "a");
+
+ /* Archive it with lrzip compression. */
+ assertEqualInt(0,
+ systemf("echo f | %s -o --lrzip >archive.out 2>archive.err",
+ testprog));
+ p = slurpfile(&s, "archive.err");
+ p[s] = '\0';
+ /* Check that the archive file has an lzma signature. */
+ p = slurpfile(&s, "archive.out");
+ assert(s > 2);
+ assertEqualMem(p, "LRZI\x00", 5);
+}
.It Fl l , Fl Fl check-links
(c and r modes only)
Issue a warning message unless all links to each file are archived.
+.It Fl Fl lrzip
+(c mode only)
+Compress the resulting archive with
+.Xr lrzip 1 .
+In extract or list modes, this option is ignored.
.It Fl Fl lzma
(c mode only) Compress the resulting archive with the original LZMA algorithm.
Use of this option is discouraged and new archives should be created with
Compress the resulting archive with
.Xr lzop 1 .
In extract or list modes, this option is ignored.
-Note that, unlike other
-.Nm tar
-implementations, this implementation recognizes lzop compression
-automatically when reading archives.
.It Fl m , Fl Fl modification-time
(x mode only)
Do not extract modification time.
/* GNU tar 1.13 used -l for --one-file-system */
bsdtar->option_warn_links = 1;
break;
+ case OPTION_LRZIP:
case OPTION_LZIP: /* GNU tar beginning with 1.23 */
case OPTION_LZMA: /* GNU tar beginning with 1.20 */
case OPTION_LZOP: /* GNU tar beginning with 1.21 */
OPTION_HELP,
OPTION_INCLUDE,
OPTION_KEEP_NEWER_FILES,
+ OPTION_LRZIP,
OPTION_LZIP,
OPTION_LZMA,
OPTION_LZOP,
{ "keep-newer-files", 0, OPTION_KEEP_NEWER_FILES },
{ "keep-old-files", 0, 'k' },
{ "list", 0, 't' },
+ { "lrzip", 0, OPTION_LRZIP },
{ "lzip", 0, OPTION_LZIP },
{ "lzma", 0, OPTION_LZMA },
{ "lzop", 0, OPTION_LZOP },
test_option_gid_gname.c
test_option_k.c
test_option_keep_newer_files.c
+ test_option_lrzip.c
test_option_lzma.c
test_option_lzop.c
test_option_n.c
--- /dev/null
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2012 Michihiro NAKAJIMA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_option_lrzip)
+{
+ char *p;
+ size_t s;
+
+ if (!canLrzip()) {
+ skipping("lrzip is not supported on this platform");
+ return;
+ }
+
+ /* Create a file. */
+ assertMakeFile("f", 0644, "a");
+
+ /* Archive it with lrzip compression. */
+ assertEqualInt(0,
+ systemf("%s -cf - --lrzip f >archive.out 2>archive.err",
+ testprog));
+ p = slurpfile(&s, "archive.err");
+ p[s] = '\0';
+ /* Check that the archive file has an lzma signature. */
+ p = slurpfile(&s, "archive.out");
+ assert(s > 2);
+ assertEqualMem(p, "LRZI\x00", 5);
+}
case 'J':
r = archive_write_set_compression_xz(a);
break;
+ case OPTION_LRZIP:
+ r = archive_write_add_filter_lrzip(a);
+ break;
case OPTION_LZIP:
r = archive_write_set_compression_lzip(a);
break;