annotate src/zlib-1.2.7/examples/gzappend.c @ 89:8a15ff55d9af

Add bzip2, zlib, liblo, portaudio sources
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 13:59:52 +0000
parents
children
rev   line source
cannam@89 1 /* gzappend -- command to append to a gzip file
cannam@89 2
cannam@89 3 Copyright (C) 2003 Mark Adler, all rights reserved
cannam@89 4 version 1.1, 4 Nov 2003
cannam@89 5
cannam@89 6 This software is provided 'as-is', without any express or implied
cannam@89 7 warranty. In no event will the author be held liable for any damages
cannam@89 8 arising from the use of this software.
cannam@89 9
cannam@89 10 Permission is granted to anyone to use this software for any purpose,
cannam@89 11 including commercial applications, and to alter it and redistribute it
cannam@89 12 freely, subject to the following restrictions:
cannam@89 13
cannam@89 14 1. The origin of this software must not be misrepresented; you must not
cannam@89 15 claim that you wrote the original software. If you use this software
cannam@89 16 in a product, an acknowledgment in the product documentation would be
cannam@89 17 appreciated but is not required.
cannam@89 18 2. Altered source versions must be plainly marked as such, and must not be
cannam@89 19 misrepresented as being the original software.
cannam@89 20 3. This notice may not be removed or altered from any source distribution.
cannam@89 21
cannam@89 22 Mark Adler madler@alumni.caltech.edu
cannam@89 23 */
cannam@89 24
cannam@89 25 /*
cannam@89 26 * Change history:
cannam@89 27 *
cannam@89 28 * 1.0 19 Oct 2003 - First version
cannam@89 29 * 1.1 4 Nov 2003 - Expand and clarify some comments and notes
cannam@89 30 * - Add version and copyright to help
cannam@89 31 * - Send help to stdout instead of stderr
cannam@89 32 * - Add some preemptive typecasts
cannam@89 33 * - Add L to constants in lseek() calls
cannam@89 34 * - Remove some debugging information in error messages
cannam@89 35 * - Use new data_type definition for zlib 1.2.1
cannam@89 36 * - Simplfy and unify file operations
cannam@89 37 * - Finish off gzip file in gztack()
cannam@89 38 * - Use deflatePrime() instead of adding empty blocks
cannam@89 39 * - Keep gzip file clean on appended file read errors
cannam@89 40 * - Use in-place rotate instead of auxiliary buffer
cannam@89 41 * (Why you ask? Because it was fun to write!)
cannam@89 42 */
cannam@89 43
cannam@89 44 /*
cannam@89 45 gzappend takes a gzip file and appends to it, compressing files from the
cannam@89 46 command line or data from stdin. The gzip file is written to directly, to
cannam@89 47 avoid copying that file, in case it's large. Note that this results in the
cannam@89 48 unfriendly behavior that if gzappend fails, the gzip file is corrupted.
cannam@89 49
cannam@89 50 This program was written to illustrate the use of the new Z_BLOCK option of
cannam@89 51 zlib 1.2.x's inflate() function. This option returns from inflate() at each
cannam@89 52 block boundary to facilitate locating and modifying the last block bit at
cannam@89 53 the start of the final deflate block. Also whether using Z_BLOCK or not,
cannam@89 54 another required feature of zlib 1.2.x is that inflate() now provides the
cannam@89 55 number of unusued bits in the last input byte used. gzappend will not work
cannam@89 56 with versions of zlib earlier than 1.2.1.
cannam@89 57
cannam@89 58 gzappend first decompresses the gzip file internally, discarding all but
cannam@89 59 the last 32K of uncompressed data, and noting the location of the last block
cannam@89 60 bit and the number of unused bits in the last byte of the compressed data.
cannam@89 61 The gzip trailer containing the CRC-32 and length of the uncompressed data
cannam@89 62 is verified. This trailer will be later overwritten.
cannam@89 63
cannam@89 64 Then the last block bit is cleared by seeking back in the file and rewriting
cannam@89 65 the byte that contains it. Seeking forward, the last byte of the compressed
cannam@89 66 data is saved along with the number of unused bits to initialize deflate.
cannam@89 67
cannam@89 68 A deflate process is initialized, using the last 32K of the uncompressed
cannam@89 69 data from the gzip file to initialize the dictionary. If the total
cannam@89 70 uncompressed data was less than 32K, then all of it is used to initialize
cannam@89 71 the dictionary. The deflate output bit buffer is also initialized with the
cannam@89 72 last bits from the original deflate stream. From here on, the data to
cannam@89 73 append is simply compressed using deflate, and written to the gzip file.
cannam@89 74 When that is complete, the new CRC-32 and uncompressed length are written
cannam@89 75 as the trailer of the gzip file.
cannam@89 76 */
cannam@89 77
cannam@89 78 #include <stdio.h>
cannam@89 79 #include <stdlib.h>
cannam@89 80 #include <string.h>
cannam@89 81 #include <fcntl.h>
cannam@89 82 #include <unistd.h>
cannam@89 83 #include "zlib.h"
cannam@89 84
cannam@89 85 #define local static
cannam@89 86 #define LGCHUNK 14
cannam@89 87 #define CHUNK (1U << LGCHUNK)
cannam@89 88 #define DSIZE 32768U
cannam@89 89
cannam@89 90 /* print an error message and terminate with extreme prejudice */
cannam@89 91 local void bye(char *msg1, char *msg2)
cannam@89 92 {
cannam@89 93 fprintf(stderr, "gzappend error: %s%s\n", msg1, msg2);
cannam@89 94 exit(1);
cannam@89 95 }
cannam@89 96
cannam@89 97 /* return the greatest common divisor of a and b using Euclid's algorithm,
cannam@89 98 modified to be fast when one argument much greater than the other, and
cannam@89 99 coded to avoid unnecessary swapping */
cannam@89 100 local unsigned gcd(unsigned a, unsigned b)
cannam@89 101 {
cannam@89 102 unsigned c;
cannam@89 103
cannam@89 104 while (a && b)
cannam@89 105 if (a > b) {
cannam@89 106 c = b;
cannam@89 107 while (a - c >= c)
cannam@89 108 c <<= 1;
cannam@89 109 a -= c;
cannam@89 110 }
cannam@89 111 else {
cannam@89 112 c = a;
cannam@89 113 while (b - c >= c)
cannam@89 114 c <<= 1;
cannam@89 115 b -= c;
cannam@89 116 }
cannam@89 117 return a + b;
cannam@89 118 }
cannam@89 119
cannam@89 120 /* rotate list[0..len-1] left by rot positions, in place */
cannam@89 121 local void rotate(unsigned char *list, unsigned len, unsigned rot)
cannam@89 122 {
cannam@89 123 unsigned char tmp;
cannam@89 124 unsigned cycles;
cannam@89 125 unsigned char *start, *last, *to, *from;
cannam@89 126
cannam@89 127 /* normalize rot and handle degenerate cases */
cannam@89 128 if (len < 2) return;
cannam@89 129 if (rot >= len) rot %= len;
cannam@89 130 if (rot == 0) return;
cannam@89 131
cannam@89 132 /* pointer to last entry in list */
cannam@89 133 last = list + (len - 1);
cannam@89 134
cannam@89 135 /* do simple left shift by one */
cannam@89 136 if (rot == 1) {
cannam@89 137 tmp = *list;
cannam@89 138 memcpy(list, list + 1, len - 1);
cannam@89 139 *last = tmp;
cannam@89 140 return;
cannam@89 141 }
cannam@89 142
cannam@89 143 /* do simple right shift by one */
cannam@89 144 if (rot == len - 1) {
cannam@89 145 tmp = *last;
cannam@89 146 memmove(list + 1, list, len - 1);
cannam@89 147 *list = tmp;
cannam@89 148 return;
cannam@89 149 }
cannam@89 150
cannam@89 151 /* otherwise do rotate as a set of cycles in place */
cannam@89 152 cycles = gcd(len, rot); /* number of cycles */
cannam@89 153 do {
cannam@89 154 start = from = list + cycles; /* start index is arbitrary */
cannam@89 155 tmp = *from; /* save entry to be overwritten */
cannam@89 156 for (;;) {
cannam@89 157 to = from; /* next step in cycle */
cannam@89 158 from += rot; /* go right rot positions */
cannam@89 159 if (from > last) from -= len; /* (pointer better not wrap) */
cannam@89 160 if (from == start) break; /* all but one shifted */
cannam@89 161 *to = *from; /* shift left */
cannam@89 162 }
cannam@89 163 *to = tmp; /* complete the circle */
cannam@89 164 } while (--cycles);
cannam@89 165 }
cannam@89 166
cannam@89 167 /* structure for gzip file read operations */
cannam@89 168 typedef struct {
cannam@89 169 int fd; /* file descriptor */
cannam@89 170 int size; /* 1 << size is bytes in buf */
cannam@89 171 unsigned left; /* bytes available at next */
cannam@89 172 unsigned char *buf; /* buffer */
cannam@89 173 unsigned char *next; /* next byte in buffer */
cannam@89 174 char *name; /* file name for error messages */
cannam@89 175 } file;
cannam@89 176
cannam@89 177 /* reload buffer */
cannam@89 178 local int readin(file *in)
cannam@89 179 {
cannam@89 180 int len;
cannam@89 181
cannam@89 182 len = read(in->fd, in->buf, 1 << in->size);
cannam@89 183 if (len == -1) bye("error reading ", in->name);
cannam@89 184 in->left = (unsigned)len;
cannam@89 185 in->next = in->buf;
cannam@89 186 return len;
cannam@89 187 }
cannam@89 188
cannam@89 189 /* read from file in, exit if end-of-file */
cannam@89 190 local int readmore(file *in)
cannam@89 191 {
cannam@89 192 if (readin(in) == 0) bye("unexpected end of ", in->name);
cannam@89 193 return 0;
cannam@89 194 }
cannam@89 195
cannam@89 196 #define read1(in) (in->left == 0 ? readmore(in) : 0, \
cannam@89 197 in->left--, *(in->next)++)
cannam@89 198
cannam@89 199 /* skip over n bytes of in */
cannam@89 200 local void skip(file *in, unsigned n)
cannam@89 201 {
cannam@89 202 unsigned bypass;
cannam@89 203
cannam@89 204 if (n > in->left) {
cannam@89 205 n -= in->left;
cannam@89 206 bypass = n & ~((1U << in->size) - 1);
cannam@89 207 if (bypass) {
cannam@89 208 if (lseek(in->fd, (off_t)bypass, SEEK_CUR) == -1)
cannam@89 209 bye("seeking ", in->name);
cannam@89 210 n -= bypass;
cannam@89 211 }
cannam@89 212 readmore(in);
cannam@89 213 if (n > in->left)
cannam@89 214 bye("unexpected end of ", in->name);
cannam@89 215 }
cannam@89 216 in->left -= n;
cannam@89 217 in->next += n;
cannam@89 218 }
cannam@89 219
cannam@89 220 /* read a four-byte unsigned integer, little-endian, from in */
cannam@89 221 unsigned long read4(file *in)
cannam@89 222 {
cannam@89 223 unsigned long val;
cannam@89 224
cannam@89 225 val = read1(in);
cannam@89 226 val += (unsigned)read1(in) << 8;
cannam@89 227 val += (unsigned long)read1(in) << 16;
cannam@89 228 val += (unsigned long)read1(in) << 24;
cannam@89 229 return val;
cannam@89 230 }
cannam@89 231
cannam@89 232 /* skip over gzip header */
cannam@89 233 local void gzheader(file *in)
cannam@89 234 {
cannam@89 235 int flags;
cannam@89 236 unsigned n;
cannam@89 237
cannam@89 238 if (read1(in) != 31 || read1(in) != 139) bye(in->name, " not a gzip file");
cannam@89 239 if (read1(in) != 8) bye("unknown compression method in", in->name);
cannam@89 240 flags = read1(in);
cannam@89 241 if (flags & 0xe0) bye("unknown header flags set in", in->name);
cannam@89 242 skip(in, 6);
cannam@89 243 if (flags & 4) {
cannam@89 244 n = read1(in);
cannam@89 245 n += (unsigned)(read1(in)) << 8;
cannam@89 246 skip(in, n);
cannam@89 247 }
cannam@89 248 if (flags & 8) while (read1(in) != 0) ;
cannam@89 249 if (flags & 16) while (read1(in) != 0) ;
cannam@89 250 if (flags & 2) skip(in, 2);
cannam@89 251 }
cannam@89 252
cannam@89 253 /* decompress gzip file "name", return strm with a deflate stream ready to
cannam@89 254 continue compression of the data in the gzip file, and return a file
cannam@89 255 descriptor pointing to where to write the compressed data -- the deflate
cannam@89 256 stream is initialized to compress using level "level" */
cannam@89 257 local int gzscan(char *name, z_stream *strm, int level)
cannam@89 258 {
cannam@89 259 int ret, lastbit, left, full;
cannam@89 260 unsigned have;
cannam@89 261 unsigned long crc, tot;
cannam@89 262 unsigned char *window;
cannam@89 263 off_t lastoff, end;
cannam@89 264 file gz;
cannam@89 265
cannam@89 266 /* open gzip file */
cannam@89 267 gz.name = name;
cannam@89 268 gz.fd = open(name, O_RDWR, 0);
cannam@89 269 if (gz.fd == -1) bye("cannot open ", name);
cannam@89 270 gz.buf = malloc(CHUNK);
cannam@89 271 if (gz.buf == NULL) bye("out of memory", "");
cannam@89 272 gz.size = LGCHUNK;
cannam@89 273 gz.left = 0;
cannam@89 274
cannam@89 275 /* skip gzip header */
cannam@89 276 gzheader(&gz);
cannam@89 277
cannam@89 278 /* prepare to decompress */
cannam@89 279 window = malloc(DSIZE);
cannam@89 280 if (window == NULL) bye("out of memory", "");
cannam@89 281 strm->zalloc = Z_NULL;
cannam@89 282 strm->zfree = Z_NULL;
cannam@89 283 strm->opaque = Z_NULL;
cannam@89 284 ret = inflateInit2(strm, -15);
cannam@89 285 if (ret != Z_OK) bye("out of memory", " or library mismatch");
cannam@89 286
cannam@89 287 /* decompress the deflate stream, saving append information */
cannam@89 288 lastbit = 0;
cannam@89 289 lastoff = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
cannam@89 290 left = 0;
cannam@89 291 strm->avail_in = gz.left;
cannam@89 292 strm->next_in = gz.next;
cannam@89 293 crc = crc32(0L, Z_NULL, 0);
cannam@89 294 have = full = 0;
cannam@89 295 do {
cannam@89 296 /* if needed, get more input */
cannam@89 297 if (strm->avail_in == 0) {
cannam@89 298 readmore(&gz);
cannam@89 299 strm->avail_in = gz.left;
cannam@89 300 strm->next_in = gz.next;
cannam@89 301 }
cannam@89 302
cannam@89 303 /* set up output to next available section of sliding window */
cannam@89 304 strm->avail_out = DSIZE - have;
cannam@89 305 strm->next_out = window + have;
cannam@89 306
cannam@89 307 /* inflate and check for errors */
cannam@89 308 ret = inflate(strm, Z_BLOCK);
cannam@89 309 if (ret == Z_STREAM_ERROR) bye("internal stream error!", "");
cannam@89 310 if (ret == Z_MEM_ERROR) bye("out of memory", "");
cannam@89 311 if (ret == Z_DATA_ERROR)
cannam@89 312 bye("invalid compressed data--format violated in", name);
cannam@89 313
cannam@89 314 /* update crc and sliding window pointer */
cannam@89 315 crc = crc32(crc, window + have, DSIZE - have - strm->avail_out);
cannam@89 316 if (strm->avail_out)
cannam@89 317 have = DSIZE - strm->avail_out;
cannam@89 318 else {
cannam@89 319 have = 0;
cannam@89 320 full = 1;
cannam@89 321 }
cannam@89 322
cannam@89 323 /* process end of block */
cannam@89 324 if (strm->data_type & 128) {
cannam@89 325 if (strm->data_type & 64)
cannam@89 326 left = strm->data_type & 0x1f;
cannam@89 327 else {
cannam@89 328 lastbit = strm->data_type & 0x1f;
cannam@89 329 lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in;
cannam@89 330 }
cannam@89 331 }
cannam@89 332 } while (ret != Z_STREAM_END);
cannam@89 333 inflateEnd(strm);
cannam@89 334 gz.left = strm->avail_in;
cannam@89 335 gz.next = strm->next_in;
cannam@89 336
cannam@89 337 /* save the location of the end of the compressed data */
cannam@89 338 end = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
cannam@89 339
cannam@89 340 /* check gzip trailer and save total for deflate */
cannam@89 341 if (crc != read4(&gz))
cannam@89 342 bye("invalid compressed data--crc mismatch in ", name);
cannam@89 343 tot = strm->total_out;
cannam@89 344 if ((tot & 0xffffffffUL) != read4(&gz))
cannam@89 345 bye("invalid compressed data--length mismatch in", name);
cannam@89 346
cannam@89 347 /* if not at end of file, warn */
cannam@89 348 if (gz.left || readin(&gz))
cannam@89 349 fprintf(stderr,
cannam@89 350 "gzappend warning: junk at end of gzip file overwritten\n");
cannam@89 351
cannam@89 352 /* clear last block bit */
cannam@89 353 lseek(gz.fd, lastoff - (lastbit != 0), SEEK_SET);
cannam@89 354 if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
cannam@89 355 *gz.buf = (unsigned char)(*gz.buf ^ (1 << ((8 - lastbit) & 7)));
cannam@89 356 lseek(gz.fd, -1L, SEEK_CUR);
cannam@89 357 if (write(gz.fd, gz.buf, 1) != 1) bye("writing after seek to ", name);
cannam@89 358
cannam@89 359 /* if window wrapped, build dictionary from window by rotating */
cannam@89 360 if (full) {
cannam@89 361 rotate(window, DSIZE, have);
cannam@89 362 have = DSIZE;
cannam@89 363 }
cannam@89 364
cannam@89 365 /* set up deflate stream with window, crc, total_in, and leftover bits */
cannam@89 366 ret = deflateInit2(strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
cannam@89 367 if (ret != Z_OK) bye("out of memory", "");
cannam@89 368 deflateSetDictionary(strm, window, have);
cannam@89 369 strm->adler = crc;
cannam@89 370 strm->total_in = tot;
cannam@89 371 if (left) {
cannam@89 372 lseek(gz.fd, --end, SEEK_SET);
cannam@89 373 if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
cannam@89 374 deflatePrime(strm, 8 - left, *gz.buf);
cannam@89 375 }
cannam@89 376 lseek(gz.fd, end, SEEK_SET);
cannam@89 377
cannam@89 378 /* clean up and return */
cannam@89 379 free(window);
cannam@89 380 free(gz.buf);
cannam@89 381 return gz.fd;
cannam@89 382 }
cannam@89 383
cannam@89 384 /* append file "name" to gzip file gd using deflate stream strm -- if last
cannam@89 385 is true, then finish off the deflate stream at the end */
cannam@89 386 local void gztack(char *name, int gd, z_stream *strm, int last)
cannam@89 387 {
cannam@89 388 int fd, len, ret;
cannam@89 389 unsigned left;
cannam@89 390 unsigned char *in, *out;
cannam@89 391
cannam@89 392 /* open file to compress and append */
cannam@89 393 fd = 0;
cannam@89 394 if (name != NULL) {
cannam@89 395 fd = open(name, O_RDONLY, 0);
cannam@89 396 if (fd == -1)
cannam@89 397 fprintf(stderr, "gzappend warning: %s not found, skipping ...\n",
cannam@89 398 name);
cannam@89 399 }
cannam@89 400
cannam@89 401 /* allocate buffers */
cannam@89 402 in = fd == -1 ? NULL : malloc(CHUNK);
cannam@89 403 out = malloc(CHUNK);
cannam@89 404 if (out == NULL) bye("out of memory", "");
cannam@89 405
cannam@89 406 /* compress input file and append to gzip file */
cannam@89 407 do {
cannam@89 408 /* get more input */
cannam@89 409 len = fd == -1 ? 0 : read(fd, in, CHUNK);
cannam@89 410 if (len == -1) {
cannam@89 411 fprintf(stderr,
cannam@89 412 "gzappend warning: error reading %s, skipping rest ...\n",
cannam@89 413 name);
cannam@89 414 len = 0;
cannam@89 415 }
cannam@89 416 strm->avail_in = (unsigned)len;
cannam@89 417 strm->next_in = in;
cannam@89 418 if (len) strm->adler = crc32(strm->adler, in, (unsigned)len);
cannam@89 419
cannam@89 420 /* compress and write all available output */
cannam@89 421 do {
cannam@89 422 strm->avail_out = CHUNK;
cannam@89 423 strm->next_out = out;
cannam@89 424 ret = deflate(strm, last && len == 0 ? Z_FINISH : Z_NO_FLUSH);
cannam@89 425 left = CHUNK - strm->avail_out;
cannam@89 426 while (left) {
cannam@89 427 len = write(gd, out + CHUNK - strm->avail_out - left, left);
cannam@89 428 if (len == -1) bye("writing gzip file", "");
cannam@89 429 left -= (unsigned)len;
cannam@89 430 }
cannam@89 431 } while (strm->avail_out == 0 && ret != Z_STREAM_END);
cannam@89 432 } while (len != 0);
cannam@89 433
cannam@89 434 /* write trailer after last entry */
cannam@89 435 if (last) {
cannam@89 436 deflateEnd(strm);
cannam@89 437 out[0] = (unsigned char)(strm->adler);
cannam@89 438 out[1] = (unsigned char)(strm->adler >> 8);
cannam@89 439 out[2] = (unsigned char)(strm->adler >> 16);
cannam@89 440 out[3] = (unsigned char)(strm->adler >> 24);
cannam@89 441 out[4] = (unsigned char)(strm->total_in);
cannam@89 442 out[5] = (unsigned char)(strm->total_in >> 8);
cannam@89 443 out[6] = (unsigned char)(strm->total_in >> 16);
cannam@89 444 out[7] = (unsigned char)(strm->total_in >> 24);
cannam@89 445 len = 8;
cannam@89 446 do {
cannam@89 447 ret = write(gd, out + 8 - len, len);
cannam@89 448 if (ret == -1) bye("writing gzip file", "");
cannam@89 449 len -= ret;
cannam@89 450 } while (len);
cannam@89 451 close(gd);
cannam@89 452 }
cannam@89 453
cannam@89 454 /* clean up and return */
cannam@89 455 free(out);
cannam@89 456 if (in != NULL) free(in);
cannam@89 457 if (fd > 0) close(fd);
cannam@89 458 }
cannam@89 459
cannam@89 460 /* process the compression level option if present, scan the gzip file, and
cannam@89 461 append the specified files, or append the data from stdin if no other file
cannam@89 462 names are provided on the command line -- the gzip file must be writable
cannam@89 463 and seekable */
cannam@89 464 int main(int argc, char **argv)
cannam@89 465 {
cannam@89 466 int gd, level;
cannam@89 467 z_stream strm;
cannam@89 468
cannam@89 469 /* ignore command name */
cannam@89 470 argv++;
cannam@89 471
cannam@89 472 /* provide usage if no arguments */
cannam@89 473 if (*argv == NULL) {
cannam@89 474 printf("gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\n");
cannam@89 475 printf(
cannam@89 476 "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n");
cannam@89 477 return 0;
cannam@89 478 }
cannam@89 479
cannam@89 480 /* set compression level */
cannam@89 481 level = Z_DEFAULT_COMPRESSION;
cannam@89 482 if (argv[0][0] == '-') {
cannam@89 483 if (argv[0][1] < '0' || argv[0][1] > '9' || argv[0][2] != 0)
cannam@89 484 bye("invalid compression level", "");
cannam@89 485 level = argv[0][1] - '0';
cannam@89 486 if (*++argv == NULL) bye("no gzip file name after options", "");
cannam@89 487 }
cannam@89 488
cannam@89 489 /* prepare to append to gzip file */
cannam@89 490 gd = gzscan(*argv++, &strm, level);
cannam@89 491
cannam@89 492 /* append files on command line, or from stdin if none */
cannam@89 493 if (*argv == NULL)
cannam@89 494 gztack(NULL, gd, &strm, 1);
cannam@89 495 else
cannam@89 496 do {
cannam@89 497 gztack(*argv, gd, &strm, argv[1] == NULL);
cannam@89 498 } while (*++argv != NULL);
cannam@89 499 return 0;
cannam@89 500 }