diff options
author | delphij <delphij@FreeBSD.org> | 2013-10-16 17:16:40 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2013-10-16 17:16:40 +0000 |
commit | 7a806a64eabb6a6bc145d48b2705d1ba8e71c76e (patch) | |
tree | cb36ee81a4604aff5a6bf817cd829cb0f26466d7 /lib | |
parent | 404c6c2644ee972150210c246e665a663466e9a8 (diff) | |
download | FreeBSD-src-7a806a64eabb6a6bc145d48b2705d1ba8e71c76e.zip FreeBSD-src-7a806a64eabb6a6bc145d48b2705d1ba8e71c76e.tar.gz |
Make it possible to seek within a gzip stream.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libz/zopen.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libz/zopen.c b/lib/libz/zopen.c index 822a5e1..d570c98 100644 --- a/lib/libz/zopen.c +++ b/lib/libz/zopen.c @@ -29,6 +29,12 @@ xgzclose(void *cookie) return gzclose(cookie); } +static fpos_t +xgzseek(void *cookie, fpos_t offset, int whence) +{ + return gzseek(cookie, (z_off_t)offset, whence); +} + FILE * zopen(const char *fname, const char *mode) { @@ -37,7 +43,7 @@ zopen(const char *fname, const char *mode) return NULL; if(*mode == 'r') - return (funopen(gz, xgzread, NULL, NULL, xgzclose)); + return (funopen(gz, xgzread, NULL, xgzseek, xgzclose)); else - return (funopen(gz, NULL, xgzwrite, NULL, xgzclose)); + return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose)); } |