From: tam@eel.ocgy.ubc.ca (Joe Tam)
Subject: Patch to make gnutar 1.10 use zip compression
Reply-To: tam@ocgy.ubc.ca
Organization: University of British Columbia, Vancouver, B.C., Canada
Date: Wed, 26 Aug 1992 22:13:47 GMT

Here's a patch I whipped for gnutar 1.10 to use with zip 1.9 and unzip
5.0.  If you specify the 'z' option instead of the 'Z' option, it will
pipe the archive through the zip compressor/decompressor instead on
Unix's compress.  The default compression is -9 (I figure that if you
go through all the trouble to apply this patch to gnutar, you probably
want maximum compression).


One note:  funzip (the decompression filter that is packaged with unzip
5.0) will exit with status=1 and the new gnutar will complain about
it.  To get rid of this, just put in a "exit(0);" statement at the end
of the main() routine (next to the last line) in funzip.c.

The new gnutar expects zip and funzip to be in your binary search
path.

----------------------- Cut here ------------------------------------
gnutar1.10/patch.zip
diff -c ./buffer.c ../ziptar/buffer.c
*** ./buffer.c	Mon Jul  1 11:15:53 1991
--- ../ziptar/buffer.c	Wed Aug 26 11:44:37 1992
***************
*** 464,473 ****
  		}
  	}
  		/* So we should exec compress (-d) */
! 	if(ar_reading)
! 		execlp("compress", "compress", "-d", (char *)0);
! 	else
! 		execlp("compress", "compress", (char *)0);
  	msg_perror("can't exec compress");
  	_exit(EX_SYSTEM);
  }
--- 464,480 ----
  		}
  	}
  		/* So we should exec compress (-d) */
! 	if (f_zip) {
! 		if(ar_reading)
! 			execlp("funzip", "funzip", (char *)0);
! 		else
! 			execlp("zip", "zip", "-q9", (char *)0);
! 	} else {
! 		if(ar_reading)
! 			execlp("compress", "compress", "-d", (char *)0);
! 		else
! 			execlp("compress", "compress", (char *)0);
! 	}
  	msg_perror("can't exec compress");
  	_exit(EX_SYSTEM);
  }
Only in .: patch.zip
diff -c ./tar.c ../ziptar/tar.c
*** ./tar.c	Wed Jun  5 11:56:34 1991
--- ../ziptar/tar.c	Wed Aug 26 11:40:29 1992
***************
*** 585,590 ****
--- 585,591 ----
  			break;
  
  		case 'z':		/* Easy to type */
+ 			f_zip++;
  		case 'Z':		/* Like the filename extension .Z */
  			f_compress++;
  			break;
***************
*** 673,679 ****
  -W, +verify		attempt to verify the archive after writing it\n\
  -X, +exclude FILE	exclude file FILE\n\
  +exclude-from FILE	exclude files listed in FILE\n\
! -z, -Z, +compress,\n\
      +uncompress      	filter the archive through compress\n\
  -[0-7][lmh]		specify drive and density\n\
  ", stderr);
--- 674,681 ----
  -W, +verify		attempt to verify the archive after writing it\n\
  -X, +exclude FILE	exclude file FILE\n\
  +exclude-from FILE	exclude files listed in FILE\n\
! -z                      Use zip compression\n\
! -Z, +compress,\n\
      +uncompress      	filter the archive through compress\n\
  -[0-7][lmh]		specify drive and density\n\
  ", stderr);
diff -c ./tar.h ../ziptar/tar.h
*** ./tar.h	Thu Jun 20 17:14:30 1991
--- ../ziptar/tar.h	Wed Aug 26 11:35:07 1992
***************
*** 227,234 ****
  TAR_EXTERN int  f_verify;		/* -W */
  			/* CMD_EXTRACT     -x */
  TAR_EXTERN int  f_exclude;		/* -X */
! TAR_EXTERN int 	f_compress;		/* -z */
! 					/* -Z */
  TAR_EXTERN int	f_do_chown;		/* +do-chown */
  TAR_EXTERN int  f_totals;		/* +totals */
  
--- 227,234 ----
  TAR_EXTERN int  f_verify;		/* -W */
  			/* CMD_EXTRACT     -x */
  TAR_EXTERN int  f_exclude;		/* -X */
! TAR_EXTERN int  f_zip;			/* -z */
! TAR_EXTERN int 	f_compress;		/* -Z */
  TAR_EXTERN int	f_do_chown;		/* +do-chown */
  TAR_EXTERN int  f_totals;		/* +totals */
  
----------------------- Cut here ------------------------------------
Joseph Tam <tam@ocgy.ubc.ca>   \___ \___________
Department of Oceanography     \___ \___________
University of British Columbia \___ \___________
Vancouver, BC, Canada          \___     \___
V6T 1W5                \___    \___     \___
                       \___    \___     \___
Phone: (604) 822-3911   \_________  \__ \___ \__
Fax:   (604) 822-6091    \______    \__ \___ \__

Xref: sparky comp.compression:3173 comp.compression.research:144 comp.multimedia:2578 sci.image.processing:602 comp.graphics:9416