Lines Matching refs: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
165 FILE *file;
195 gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") :
197 if (gz->file == NULL) {
231 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
251 got = fread(in, 1, 1, gz->file);
283 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
289 fclose(gz->file);
315 /* Try compressing the input file at once using mmap. Return Z_OK if
323 caddr_t buf; /* mmap'ed buffer for the entire input file */
324 off_t buf_len; /* length of the input file */
327 /* Determine the size of the file, needed for mmap: */
345 /* Compress the whole file at once: */
439 * Compress the given file: create a corresponding .gz file and remove the
442 static void file_compress(char *file, char *mode)
448 if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) {
454 snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX);
456 strcpy(outfile, file);
460 in = fopen(file, "rb");
462 perror(file);
472 unlink(file);
477 * Uncompress the given file and remove the original.
479 static void file_uncompress(char *file)
485 z_size_t len = strlen(file);
493 snprintf(buf, sizeof(buf), "%s", file);
495 strcpy(buf, file);
498 if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
499 infile = file;
503 outfile = file;
518 perror(file);
542 gzFile file;
612 file = gzdopen(fileno(stdin), "rb");
613 if (file == NULL)
617 gz_uncompress(file, stdout);
619 file = gzdopen(fileno(stdout), outmode);
620 if (file == NULL)
624 gz_compress(stdin, file);
633 file = gzopen(*argv, "rb");
634 if (file == NULL)
640 gz_uncompress(file, stdout);
652 file = gzdopen(fileno(stdout), outmode);
653 if (file == NULL)
658 gz_compress(in, file);