diff options
author | jbj <devnull@localhost> | 1998-11-18 21:41:05 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1998-11-18 21:41:05 +0000 |
commit | 2578b7fc8451f06f83640b448bda098e295447cb (patch) | |
tree | 5e2aca0b793a070ee6db89e5aa2ddee3e68ccc5d /rpm2cpio.c | |
parent | 9e52926682d6df396086c32c9c86a81212441775 (diff) | |
download | librpm-tizen-2578b7fc8451f06f83640b448bda098e295447cb.tar.gz librpm-tizen-2578b7fc8451f06f83640b448bda098e295447cb.tar.bz2 librpm-tizen-2578b7fc8451f06f83640b448bda098e295447cb.zip |
implement abstract fd type almost everywhere.
CVS patchset: 2542
CVS date: 1998/11/18 21:41:05
Diffstat (limited to 'rpm2cpio.c')
-rw-r--r-- | rpm2cpio.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/rpm2cpio.c b/rpm2cpio.c index 65cfd4353..7292bcc6c 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -15,7 +15,7 @@ char *zlib_err [] = { int main(int argc, char **argv) { - int fd; + FD_t fdi, fdo; Header hd; int rc, isSource; char buffer[1024]; @@ -23,17 +23,18 @@ int main(int argc, char **argv) gzFile stream; if (argc == 1) { - fd = 0; + fdi = fdDup(0); } else { - fd = open(argv[1], O_RDONLY, 0644); + fdi = fdOpen(argv[1], O_RDONLY, 0644); } - if (fd < 0) { + if (fdFileno(fdi) < 0) { perror("cannot open package"); exit(1); } + fdo = fdDup(1); - rc = rpmReadPackageHeader(fd, &hd, &isSource, NULL, NULL); + rc = rpmReadPackageHeader(fdi, &hd, &isSource, NULL, NULL); if (rc == 1) { fprintf(stderr, _("argument is not an RPM package\n")); exit(1); @@ -42,10 +43,10 @@ int main(int argc, char **argv) exit(1); } - stream = gzdopen(fd, "r"); + stream = gzdopen(fdFileno(fdi), "r"); while ((ct = gzread(stream, &buffer, 1024)) > 0) { - write(1, &buffer, ct); + fdWrite(fdo, &buffer, ct); } if (ct < 0){ int zerror; |