2 * Public domain stdio wrapper for libz, written by Johan Danielsson.
6 __FBSDID("$FreeBSD: stable/9/lib/libz/zopen.c 84228 2001-09-30 22:39:00Z dillon $");
11 FILE *zopen(const char *fname, const char *mode);
13 /* convert arguments */
15 xgzread(void *cookie, char *data, int size)
17 return gzread(cookie, data, size);
21 xgzwrite(void *cookie, const char *data, int size)
23 return gzwrite(cookie, (void*)data, size);
27 xgzclose(void *cookie)
29 return gzclose(cookie);
33 zopen(const char *fname, const char *mode)
35 gzFile gz = gzopen(fname, mode);
40 return (funopen(gz, xgzread, NULL, NULL, xgzclose));
42 return (funopen(gz, NULL, xgzwrite, NULL, xgzclose));