Lines Matching refs:gz
264 file gz;
267 gz.name = name;
268 gz.fd = open(name, O_RDWR, 0);
269 if (gz.fd == -1) bye("cannot open ", name);
270 gz.buf = malloc(CHUNK);
271 if (gz.buf == NULL) bye("out of memory", "");
272 gz.size = LGCHUNK;
273 gz.left = 0;
276 gzheader(&gz);
289 lastoff = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
291 strm->avail_in = gz.left;
292 strm->next_in = gz.next;
298 readmore(&gz);
299 strm->avail_in = gz.left;
300 strm->next_in = gz.next;
329 lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in;
334 gz.left = strm->avail_in;
335 gz.next = strm->next_in;
338 end = lseek(gz.fd, 0L, SEEK_CUR) - gz.left;
341 if (crc != read4(&gz))
344 if ((tot & 0xffffffffUL) != read4(&gz))
348 if (gz.left || readin(&gz))
353 lseek(gz.fd, lastoff - (lastbit != 0), SEEK_SET);
354 if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
355 *gz.buf = (unsigned char)(*gz.buf ^ (1 << ((8 - lastbit) & 7)));
356 lseek(gz.fd, -1L, SEEK_CUR);
357 if (write(gz.fd, gz.buf, 1) != 1) bye("writing after seek to ", name);
372 lseek(gz.fd, --end, SEEK_SET);
373 if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name);
374 deflatePrime(strm, 8 - left, *gz.buf);
376 lseek(gz.fd, end, SEEK_SET);
380 free(gz.buf);
381 return gz.fd;
476 "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n");