static FD_t lzdOpen(const char * path, const char * mode) { FD_t fd; LZFILE *lzfile; if ((lzfile = lzopen(path, mode)) == NULL) return NULL; fd = fdNew(path); fdPop(fd); fdPush(fd, xzdio, lzfile, -1); return fdLink(fd); }
/*@-globuse@*/ static /*@null@*/ FD_t lzdOpen(const char * path, const char * fmode) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { FD_t fd; mode_t mode = (fmode && fmode[0] == 'w' ? O_WRONLY : O_RDONLY); XZFILE * xzfile = lzopen(path, fmode); if (xzfile == NULL) return NULL; fd = fdNew("open (lzdOpen)"); fdPop(fd); fdPush(fd, lzdio, xzfile, -1); fdSetOpen(fd, path, fileno(xzfile->fp), mode); return fdLink(fd, "lzdOpen"); }
static inline FILE *mylzfdopen(int fd, const char *mode) { LZFILE *lzf = lzopen(0, mode, fd, 0); return cookieopen(lzf, mode, lzread, lzwrite, lzclose); }
static inline FILE *mylzfopen(const char *fn, const char *mode) { LZFILE *lzf = lzopen(fn, mode, -1, 0); return cookieopen(lzf, mode, lzread, lzwrite, lzclose); }