From: Simo S. <sim...@ti...> - 2001-02-06 18:23:39
|
> Giovanni Corriga wrote: > > On 06 Feb 2001 15:35:20 +0100, Hongli Lai wrote: > > On Mon, 05 Feb 2001 23:05:47 Giovanni Corriga wrote: > > > I have written support for .tar.gz files. It was really easy, I > had only > > > to switch from fopen() to gzopen() etc. > > > Files are attached. > > > > Those files haven't been committed yet. > > > > I was thinking about tgz support. > > And I think using your method (replacing fopen() to gzopen()) is a > bad > > idea. > > It will cause a lot of duplicate code. > > It was just a proposal. Being so easy to modify the code, I did it, so > you could examine it directly. > > > Wouldn't it be better to add Gzip support directly into tarlib? > > Yes, it is another solution - use gzopen() instead of fopen and the > like. gz* functions can handle uncompressed files. > In this case, ye'd better provide a tgzlib.h header. Its content would > be something like > > #include "tarlib.h" > > typedef tarfile tgzfile; > > #define tgzl_getfilelist tl_getfilelist > > [...] > > Well, when handling compressed tar archives you have two options: > > 1. handle them directly > 2. use a temporary file (first uncompress the archive, then open it). > > I thought that as long as .tar.gz archives are the most common > compressed tar archives, it would be more efficient to handle them > directly. Obviously, I'm not going to write separate code for e.g. > .tar.Z archives. > > Please, let me know what you think about this issue. > > Giovanni > I think n.1 is the good way. While handling compression on the fly may be slowly it save us from the hell of checking for double free space to hold uncompressed tar file and it's content. The same code should be easely adaptable for tar.bz2 files also as they are becoming more and more common. using zlib and bzlib is a good way, and I'm thinking if is it the case to unify tarlib and ziplib to share as much code as possibile. Simo. -- sim...@ti... http://www.geocities.com/SiliconValley/9757 |