Zlib for creating PK format zip files?

Zlib for creating PK format zip files?

Post by J. P » Sun, 15 Nov 1998 04:00:00



From what I understand from reading the ZipInfo Web page, zlib is used
to handle gzip compression format instead of pkzip format.

Is there a zlib version for the latter somewhere?  Do I have to resort
to hacking the source for the zip program to get a linkable decompressor
for that?  I don't want to use PKWARE for that.

Thanks,
Joe Pannon

 
 
 

Zlib for creating PK format zip files?

Post by steve mcada » Mon, 16 Nov 1998 04:00:00




Quote:>From what I understand from reading the ZipInfo Web page, zlib is used
>to handle gzip compression format instead of pkzip format.

>Is there a zlib version for the latter somewhere?  Do I have to resort
>to hacking the source for the zip program to get a linkable decompressor
>for that?  I don't want to use PKWARE for that.

Hi Joe.  The actual compressed data in a pkzip file is the same thing.
You have to use MAX_WBITS (I think that's the one) set to -1 to
prevent some table from getting created/looked for.  The tough part is
that you have to implement the code that reads/writes zip file format,
which contains the compressed files and a directory.  There's a minzip
example in the zlib download that should get you started.  The file
that explains zip internal format is available on the web and I'm sure
I found it starting at the "official zlib home page" at
http://www.cdrom.com/pub/infozip/zlib/ but don't remember the exact
url of the format description.  -steve

 
 
 

Zlib for creating PK format zip files?

Post by J. P » Mon, 16 Nov 1998 04:00:00



>From what I understand from reading the ZipInfo Web page, zlib is used
>to handle gzip compression format instead of pkzip format.

>Is there a zlib version for the latter somewhere?

Oops!  What I meant to write in the above sentence:

Quote:>Is there a PKzip version for the latter somewhere?

I need to create a PKZip compatible archive on a Unix platform that
will be unzipped under Win95/98 with PKZIP.

Joe

 
 
 

Zlib for creating PK format zip files?

Post by Aandi Inst » Mon, 16 Nov 1998 04:00:00



>I need to create a PKZip compatible archive on a Unix platform that
>will be unzipped under Win95/98 with PKZIP.

From what I remember PKWare offer a PKZIP for Unix, but it isn't
available as shareware.
----------------------------------------

Visit http://www.quite.com/ps/ for information on
PostScript, including EPS in 10 easy stages.
 
 
 

Zlib for creating PK format zip files?

Post by J. P » Mon, 16 Nov 1998 04:00:00



> The actual compressed data in a pkzip file is the same thing.
> You have to use MAX_WBITS (I think that's the one) set to -1 to
> prevent some table from getting created/looked for.

I suspected it might be the case, but I could not find any explicit
mention
of it in the zlib tar file that I downloaded.  What threw me off totally
when I saw that the build actually created a small foo.gz test file as
well.
Are you really saying that .zip and .gz files are essentially the same?
Then why the different extensions?  Besides, the unzip program can't even
unzip the foo.gz; it complains about some "End-of-central-directory
signature
not found." problem.  The "gunzip" program, however, had no problem with
it.

I also checked all the references to MAX_WBITS in the source but there is
no mention there anything about what value to choose for .gz or .zip file
format.  Then I checked all references to PKZIP but I only found a three
source files with some conditional compile based on
#ifndef PKZIP_BUG_WORKAROUND
condition.  Now, I could probably figure out more by wading through the
code, but I just don't have that kind of time, not to mention that much
of it is probably way over my head. :-(

Quote:> The file
> that explains zip internal format is available on the web and I'm sure
> I found it starting at the "official zlib home page" at
> http://www.cdrom.com/pub/infozip/zlib/ but don't remember the exact
> url of the format description.

Yes, I've seen it, but I was hoping that I would not have to go down to
that level.  What I mean is that I just wanted to specify what files I
wanted to archive into what zip file and there would be some zlib function
that would take it from there.  If I can't do this with a zlib function
than
I might as well adapt the stand-alone zip source code to do this for me,
essentially seeing what function the main() is calling for what command
line options.  I really don't have the time or even the desire to be a
file compression expert for this one-time short project.  It would not be
cost effective.

Thanks,
Joe

 
 
 

Zlib for creating PK format zip files?

Post by Phil Norma » Mon, 16 Nov 1998 04:00:00





> >I need to create a PKZip compatible archive on a Unix platform that
> >will be unzipped under Win95/98 with PKZIP.

> From what I remember PKWare offer a PKZIP for Unix, but it isn't
> available as shareware.

There is infozip, which can be found at:

<http://www.cdrom.com/pub/infozip/>

That contains all source, IIRC.

Cheers,
Phil

 
 
 

Zlib for creating PK format zip files?

Post by J. P » Tue, 17 Nov 1998 04:00:00



>There is infozip, which can be found at:

><http://www.cdrom.com/pub/infozip/>

>That contains all source, IIRC.

Phil,
I've ben to InfoZip but the zlib source that's there produces only gzip
format compressed output from what I could see.  The source for zip does
provide PKzip output, but it's a stand-alone program, not an API lib.
Now, with some effort I could adapt it to link with my code, but then
I would have to redo this after every update of the zip code; not
something I look forward to.  Having a PKzip compatible zlib, or better
yet, a higher level wrapper lib over it would be the way to go.
Well, I did notice a reference for something like that in the zlib
README file, so I haven't given up hope yet.

Thanks,
Joe

 
 
 

Zlib for creating PK format zip files?

Post by steve mcada » Tue, 17 Nov 1998 04:00:00





>> The actual compressed data in a pkzip file is the same thing.
>> You have to use MAX_WBITS (I think that's the one) set to -1 to
>> prevent some table from getting created/looked for.

>I suspected it might be the case, but I could not find any explicit
>mention
>of it in the zlib tar file that I downloaded.  What threw me off totally
>when I saw that the build actually created a small foo.gz test file as
>well.
>Are you really saying that .zip and .gz files are essentially the same?

I'm saying the actual deflated data in them is, to the best of my
knowledge, identical.  The file formats are not the same as far as I
know since there is more in the file than deflated data, but to date I
have had no interest in the .gz format so I can't be specific about
it.

Quote:>Then why the different extensions?  Besides, the unzip program can't even
>unzip the foo.gz; it complains about some "End-of-central-directory
>signature
>not found." problem.  The "gunzip" program, however, had no problem with
>it.

>I also checked all the references to MAX_WBITS in the source but there is
>no mention there anything about what value to choose for .gz or .zip file
>format.  Then I checked all references to PKZIP but I only found a three
>source files with some conditional compile based on
>#ifndef PKZIP_BUG_WORKAROUND
>condition.  Now, I could probably figure out more by wading through the
>code, but I just don't have that kind of time, not to mention that much
>of it is probably way over my head. :-(

From zip.c in the /contrib/minizip directory,

        err = deflateInit2(&zi->ci.stream, level,
               Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, 0);

There was a comment somewhere that made it clear that the -MAX_WBITS
was to prevent a "zlib table" from being written/used.  Don't remember
offhand which file it's in.  The code is not outstandingly documented
(though the comments are a lot better than some I've had to work with)
but it does work if you dig into it sufficiently.  If you want to work
with PKZIP format files the /contrib/minizip directory contains the
essential clues.  Note that some aspects of end-of-volume processing
are vaguely defined by the "spec" which explains why WinZip and PKZIP
can't always read one another's multi-volume files.  hth.

If you just want to apply money, the pkzip folks will sell you a
library without source for about $350.  If it had source I might have
gone that route but I'm nust not that trusting these days<g>

 
 
 

Zlib for creating PK format zip files?

Post by J. P » Tue, 17 Nov 1998 04:00:00



>I'm saying the actual deflated data in them is, to the best of my
>knowledge, identical.  The file formats are not the same as far as I
>know since there is more in the file than deflated data, but to date I
>have had no interest in the .gz format so I can't be specific about
>it.

Oh, I see now what you meant.  I thought you also meant the file formats
to be the same.

Quote:

>From zip.c in the /contrib/minizip directory,

>        err = deflateInit2(&zi->ci.stream, level,
>               Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, 0);

>There was a comment somewhere that made it clear that the -MAX_WBITS
>was to prevent a "zlib table" from being written/used.  Don't remember
>offhand which file it's in.  The code is not outstandingly documented
>(though the comments are a lot better than some I've had to work with)
>but it does work if you dig into it sufficiently.  If you want to work
>with PKZIP format files the /contrib/minizip directory contains the
>essential clues.  Note that some aspects of end-of-volume processing
>are vaguely defined by the "spec" which explains why WinZip and PKZIP
>can't always read one another's multi-volume files.  hth.

I think we had another misunderstanding here.  When I was talking
about the zip files (including zip.c), I meant the separate zip package,
while you were talking about the zip.c file under the /contrib/minizip
directory of the zlib package.

I just started looking into the minizip source and I am very encouraged
that it uses the zlib library and the minizip source is not too big to
be discouraging.  Thanks for pointing me to the right direction.

Quote:>If you just want to apply money, the pkzip folks will sell you a
>library without source for about $350.  If it had source I might have
>gone that route but I'm nust not that trusting these days<g>

Yes, but if you knew how long it takes to get something like that
approved at my employer and actually get it into my hand, you would
not be giving such tips. ;-)  The request would still be sitting
on the desk of some purchasing dept guy when my project's deadline
arrives.

Joe