2 * Public domain stdio wrapper for libz, written by Johan Danielsson.
11 FILE *zopen(const char *fname, const char *mode);
12 FILE *zdopen(int fd, const char *mode);
14 /* convert arguments */
16 xgzread(void *cookie, char *data, int size)
18 return gzread(cookie, data, size);
22 xgzwrite(void *cookie, const char *data, int size)
24 return gzwrite(cookie, (void*)data, size);
28 xgzclose(void *cookie)
30 return gzclose(cookie);
34 xgzseek(void *cookie, fpos_t offset, int whence)
36 return gzseek(cookie, (z_off_t)offset, whence);
40 zopen(const char *fname, const char *mode)
42 gzFile gz = gzopen(fname, mode);
47 return (funopen(gz, xgzread, NULL, xgzseek, xgzclose));
49 return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose));
53 zdopen(int fd, const char *mode)
57 gz = gzdopen(fd, mode);
62 return (funopen(gz, xgzread, NULL, xgzseek, xgzclose));
64 return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose));