diff -ur tar-1.13/src/common.h tar-1.13-patched/src/common.h
--- tar-1.13/src/common.h	Wed Jul  7 08:07:30 1999
+++ tar-1.13-patched/src/common.h	Mon Aug 20 10:10:15 2001
@@ -141,6 +141,10 @@
 GLOBAL const char *use_compress_program_option;
 
 /* Boolean value.  */
+GLOBAL int z_option_used;
+GLOBAL int archive_is_bz2;
+
+/* Boolean value.  */
 GLOBAL int dereference_option;
 
 /* Patterns that match file names to be excluded.  */
diff -ur tar-1.13/src/tar.c tar-1.13-patched/src/tar.c
--- tar-1.13/src/tar.c	Wed Jul  7 07:49:50 1999
+++ tar-1.13-patched/src/tar.c	Mon Aug 20 10:00:52 2001
@@ -16,6 +16,10 @@
    with this program; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+/* Patched to integrate bzip2 as compression filter (options -y, -j, -I)  */
+
+/* Patched to select bzip2 if z parameter specified but extension is .bz2 */
+
 #include "system.h"
 
 #include <getopt.h>
@@ -164,6 +168,8 @@
   {"block-number", no_argument, NULL, 'R'},
   {"block-size", required_argument, NULL, OBSOLETE_BLOCKING_FACTOR},
   {"blocking-factor", required_argument, NULL, 'b'},
+  {"bunzip2", required_argument, NULL, 'j'},
+  {"bzip2", required_argument, NULL, 'j'},
   {"catenate", no_argument, NULL, 'A'},
   {"checkpoint", no_argument, &checkpoint_option, 1},
   {"compare", no_argument, NULL, 'd'},
@@ -340,7 +346,9 @@
               PATTERN                at list/extract time, a globbing PATTERN\n\
   -o, --old-archive, --portability   write a V7 format archive\n\
       --posix                        write a POSIX conformant archive\n\
-  -z, --gzip, --ungzip               filter the archive through gzip\n\
+  -j, -y, -I, --bzip2, --bunzip2     filter the archive through bzip2\n\
+  -z, --gzip, --ungzip               filter the archive through bzip2 if\n\
+                                     extension is .bz2 and gzip otherwise\n\
   -Z, --compress, --uncompress       filter the archive through compress\n\
       --use-compress-program=PROG    filter through PROG (must accept -d)\n"),
 	     stdout);
@@ -416,7 +424,7 @@
    Y  per-block gzip compression */
 
 #define OPTION_STRING \
-  "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hiklmoprstuvwxz"
+  "-01234567ABC:F:GK:L:MN:OPRST:UV:WX:Zb:cdf:g:hijIklmoprstuvwxyz"
 
 static void
 set_subcommand_option (enum subcommand subcommand)
@@ -596,6 +604,10 @@
 	      xrealloc (archive_name_array,
 			sizeof (const char *) * allocated_archive_names);
 	  }
+	{
+	  ssize_t len=strlen(optarg);
+	  if (len>=4 && strcmp(optarg+len-4,".bz2")==0) archive_is_bz2=1;
+	}
 	archive_name_array[archive_names++] = optarg;
 	break;
 
@@ -788,8 +800,15 @@
 	  FATAL_ERROR ((0, errno, "%s", optarg));
 	break;
 
+      case 'j':
+      case 'I':
+      case 'y':
+	set_use_compress_program_option ("bzip2");
+	break;
+
       case 'z':
 	set_use_compress_program_option ("gzip");
+	z_option_used = 1;
 	break;
 
       case 'Z':
@@ -986,6 +1005,9 @@
 
 #endif /* not DEVICE_PREFIX */
       }
+
+  /* if z was specified but filename ends in bz2, then use bzip2 */
+  if (z_option_used && archive_is_bz2) use_compress_program_option="bzip2";
 
   /* Process trivial options.  */
 
