Submitted By: Jim Gifford <jim at cross-lfs dot org>
Date: 2009-02-21
Initial Package Version: 1.21
Upstream Status: Unknown
Origin: Jim Gifford
Description: For using lzip compression
             For using xz compression

diff -Naur tar-1.21.orig/src/buffer.c tar-1.21/src/buffer.c
--- tar-1.21.orig/src/buffer.c	2008-11-30 04:30:29.000000000 -0800
+++ tar-1.21/src/buffer.c	2009-03-01 23:16:45.338493365 -0800
@@ -203,8 +203,10 @@
   ct_compress,
   ct_gzip,
   ct_bzip2,
+  ct_lzip,
   ct_lzma,
-  ct_lzop
+  ct_lzop,
+  ct_xz
 };
 
 struct zip_magic
@@ -219,11 +221,13 @@
 static struct zip_magic const magic[] = {
   { ct_tar },
   { ct_none, },
-  { ct_compress, 2, "\037\235", "compress", "-Z" },
-  { ct_gzip,     2, "\037\213", "gzip", "-z"  },
-  { ct_bzip2,    3, "BZh",      "bzip2", "-j" },
-  { ct_lzma,     6, "\xFFLZMA", "lzma", "-J" }, /* FIXME: ???? */
-  { ct_lzop,     4, "\211LZO",  "lzop", "--lzop" },
+  { ct_compress, 2, "\037\235",     "compress", "-Z" },
+  { ct_gzip,     2, "\037\213",     "gzip",     "-z"  },
+  { ct_bzip2,    3, "BZh",          "bzip2",    "-j" },
+  { ct_lzip,     4, "LZIP",         "lzip",     "--lzip" },
+  { ct_lzma,     6, "\xFFLZMA",     "lzma",     "--lzma" },
+  { ct_lzop,     4, "\211LZO",      "lzop",     "--lzop" },
+  { ct_xz,       6, "\3757zXZ\x00", "xz",       "--xz" },
 };
 
 #define NMAGIC (sizeof(magic)/sizeof(magic[0]))
diff -Naur tar-1.21.orig/src/tar.c tar-1.21/src/tar.c
--- tar-1.21.orig/src/tar.c	2008-10-30 03:53:34.000000000 -0700
+++ tar-1.21/src/tar.c	2009-03-01 23:16:23.361084789 -0800
@@ -271,6 +271,8 @@
   IGNORE_FAILED_READ_OPTION,
   INDEX_FILE_OPTION,
   KEEP_NEWER_FILES_OPTION,
+  LZIP_OPTION,
+  LZMA_OPTION,
   LZOP_OPTION,
   MODE_OPTION,
   MTIME_OPTION,
@@ -328,7 +330,8 @@
   VERSION_OPTION,
   VOLNO_FILE_OPTION,
   WILDCARDS_MATCH_SLASH_OPTION,
-  WILDCARDS_OPTION
+  WILDCARDS_OPTION,
+  XZ_OPTION
 };
 
 const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION;
@@ -606,10 +609,14 @@
   {"compress", 'Z', 0, 0,
    N_("filter the archive through compress"), GRID+1 },
   {"uncompress", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
-  {"lzma", 'J', 0, 0,
-   N_("filter the archive through lzma"), GRID+1 },
+  {"lzip", LZIP_OPTION, 0, 0,
+   N_("filter the archive through lzip"), GRID+8 },
+  {"lzma", LZMA_OPTION, 0, 0,
+   N_("filter the archive through lzma"), GRID+8 },
   {"lzop", LZOP_OPTION, 0, 0,
    N_("filter the archive through lzop"), GRID+8 },
+  {"xz", XZ_OPTION, 0, 0,
+   N_("filter the archive through xz"), GRID+8 },
   {"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0,
    N_("filter through PROG (must accept -d)"), GRID+1 },
 #undef GRID
@@ -1374,10 +1381,6 @@
       set_use_compress_program_option ("bzip2");
       break;
 
-    case 'J':
-      set_use_compress_program_option ("lzma");
-      break;
-      
     case 'k':
       /* Don't replace existing files.  */
       old_files_option = KEEP_OLD_FILES;
@@ -1409,6 +1412,14 @@
       }
       break;
 
+    case LZIP_OPTION:
+      set_use_compress_program_option ("lzip");
+      break;
+      
+    case LZMA_OPTION:
+      set_use_compress_program_option ("lzma");
+      break;
+
     case LZOP_OPTION:
       set_use_compress_program_option ("lzop");
       break;
@@ -1562,6 +1573,10 @@
 	}
       break;
 
+    case XZ_OPTION:
+      set_use_compress_program_option ("xz");
+      break;
+
     case 'z':
       set_use_compress_program_option ("gzip");
       break;
