From 533991efdbbeff0c0f3b6f5b008c748ee61bc85e Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 30 Oct 1999 16:17:02 +0000 Subject: [PATCH] Merged back into rpmio.c. CVS patchset: 3406 CVS date: 1999/10/30 16:17:02 --- lib/rpmbzio.c | 81 ----------------------------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 lib/rpmbzio.c diff --git a/lib/rpmbzio.c b/lib/rpmbzio.c deleted file mode 100644 index 9acd3dc..0000000 --- a/lib/rpmbzio.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "system.h" - -#include -#include - -/*@access FD_t@*/ - -/* =============================================================== */ -/* Support for BZIP2 library. - */ -#ifdef HAVE_BZLIB_H - -#include - -BZFILE * bzdFileno(FD_t fd) { - return (fd != NULL ? ((BZFILE *)fd->fd_bzd) : NULL); -} - -FD_t bzdOpen(const char *pathname, const char *mode) { - FD_t fd; - BZFILE *bzfile;; - if ((bzfile = bzopen(pathname, mode)) == NULL) - return NULL; - fd = fdNew(&bzdio); - fd->fd_bzd = bzfile; - return fd; -} - -FD_t bzdFdopen(FD_t fd, const char *mode) { - BZFILE *bzfile = bzdopen(Fileno(fd), mode); - if (bzfile != NULL) { - fd->fd_fd = -1; - fd->fd_bzd = bzfile; - return fd; - } - return NULL; -} - -int bzdFlush(FD_t fd) { - return bzflush(bzdFileno(fd)); -} - -const char * bzdStrerror(FD_t fd) { - int bzerr = 0; - return bzerror(bzdFileno(fd), &bzerr); -} - -/* =============================================================== */ -static ssize_t bzdRead(void * cookie, char * buf, size_t count) { - FD_t fd = cookie; - *((char *)buf) = '\0'; - return bzread(bzdFileno(fd), buf, count); -} - -static ssize_t bzdWrite(void * cookie, const char * buf, size_t count) { - FD_t fd = cookie; - return bzwrite(bzdFileno(fd), (void *)buf, count); -} - -static int bzdSeek(void * cookie, off_t pos, int whence) { - return -1; -} - -static int bzdClose(void * cookie) { - FD_t fd = cookie; - BZFILE *bzfile; - - if (fd != NULL && (bzfile = bzdFileno(fd)) != NULL) { - fd->fd_fd = -1; - fd->fd_bzd = NULL; - fd->fd_gzd = NULL; - free(fd); - bzclose(bzfile); - return 0; - } - return -2; -} - -cookie_io_functions_t bzdio = { bzdRead, bzdWrite, bzdSeek, bzdClose }; - -#endif /* HAVE_BZLIB_H */ -- 2.7.4