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
163 FILE *file;
192 gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") :
194 if (gz->file == NULL) {
225 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
244 got = fread(in, 1, 1, gz->file);
275 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
281 fclose(gz->file);
305 /* Try compressing the input file at once using mmap. Return Z_OK if
312 caddr_t buf; /* mmap'ed buffer for the entire input file */
313 off_t buf_len; /* length of the input file */
316 /* Determine the size of the file, needed for mmap: */
325 /* Compress the whole file at once: */
390 * Compress the given file: create a corresponding .gz file and remove the
393 static void file_compress(char *file, char *mode) {
398 if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) {
404 snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX);
406 strcpy(outfile, file);
410 in = fopen(file, "rb");
412 perror(file);
422 unlink(file);
427 * Uncompress the given file and remove the original.
429 static void file_uncompress(char *file) {
434 z_size_t len = strlen(file);
442 snprintf(buf, sizeof(buf), "%s", file);
444 strcpy(buf, file);
447 if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
448 infile = file;
452 outfile = file;
467 perror(file);
490 gzFile file;
536 file = gzdopen(fileno(stdin), "rb");
537 if (file == NULL) error("can't gzdopen stdin");
538 gz_uncompress(file, stdout);
540 file = gzdopen(fileno(stdout), outmode);
541 if (file == NULL) error("can't gzdopen stdout");
542 gz_compress(stdin, file);
551 file = gzopen(*argv, "rb");
552 if (file == NULL)
555 gz_uncompress(file, stdout);
566 file = gzdopen(fileno(stdout), outmode);
567 if (file == NULL) error("can't gzdopen stdout");
569 gz_compress(in, file);