Lines Matching defs:file
9 * full-featured gzip. No attempt is made to deal with file systems
12 * real thing. On MSDOS, use only on file names without extension
38 # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
40 # define SET_BINARY_MODE(file)
54 # define fileno(file) file->__file
171 FILE *file;
222 gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") :
224 if (gz->file == NULL) {
253 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
278 got = fread(in, 1, 1, gz->file);
313 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
319 fclose(gz->file);
344 void file_compress OF((char *file, char *mode));
345 void file_uncompress OF((char *file));
392 /* Try compressing the input file at once using mmap. Return Z_OK if
402 caddr_t buf; /* mmap'ed buffer for the entire input file */
403 off_t buf_len; /* length of the input file */
406 /* Determine the size of the file, needed for mmap: */
415 /* Compress the whole file at once: */
454 * Compress the given file: create a corresponding .gz file and remove the
457 void file_compress(file, mode)
458 char *file;
465 if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) {
471 snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX);
473 strcpy(outfile, file);
477 in = fopen(file, "rb");
479 perror(file);
489 unlink(file);
494 * Uncompress the given file and remove the original.
496 void file_uncompress(file)
497 char *file;
503 size_t len = strlen(file);
511 snprintf(buf, sizeof(buf), "%s", file);
513 strcpy(buf, file);
516 if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
517 infile = file;
521 outfile = file;
536 perror(file);
562 gzFile file;
608 file = gzdopen(fileno(stdin), "rb");
609 if (file == NULL) error("can't gzdopen stdin");
610 gz_uncompress(file, stdout);
612 file = gzdopen(fileno(stdout), outmode);
613 if (file == NULL) error("can't gzdopen stdout");
614 gz_compress(stdin, file);
623 file = gzopen(*argv, "rb");
624 if (file == NULL)
627 gz_uncompress(file, stdout);
638 file = gzdopen(fileno(stdout), outmode);
639 if (file == NULL) error("can't gzdopen stdout");
641 gz_compress(in, file);