diff options
author | jbj <devnull@localhost> | 2001-06-17 22:18:03 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-06-17 22:18:03 +0000 |
commit | 29ea1567e7eafc457aed5529b240161cf8d4657f (patch) | |
tree | a791a4344419b7b942fd4d755d25a3a6b4c4e5a3 /rpm2cpio.c | |
parent | c32276cdf5c28d7d701d7211e55f28ebc6f097d7 (diff) | |
download | rpm-29ea1567e7eafc457aed5529b240161cf8d4657f.tar.gz rpm-29ea1567e7eafc457aed5529b240161cf8d4657f.tar.bz2 rpm-29ea1567e7eafc457aed5529b240161cf8d4657f.zip |
Sync with rpm-4_0 branch.
CVS patchset: 4876
CVS date: 2001/06/17 22:18:03
Diffstat (limited to 'rpm2cpio.c')
-rw-r--r-- | rpm2cpio.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/rpm2cpio.c b/rpm2cpio.c index cc7c2dc23..c82d38c67 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -14,14 +14,14 @@ int main(int argc, char **argv) FD_t gzdi; setprogname(argv[0]); /* Retrofit glibc __progname */ - if (argc == 1) { + if (argc == 1) fdi = fdDup(STDIN_FILENO); - } else { + else fdi = Fopen(argv[1], "r.ufdio"); - } - if (fdi == NULL || Ferror(fdi)) { - fprintf(stderr, _("cannot open package: %s\n"), Fstrerror(fdi)); + if (Ferror(fdi)) { + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } fdo = fdDup(STDOUT_FILENO); @@ -61,25 +61,9 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } -#ifdef DYING - { char buffer[BUFSIZ]; - int ct; - while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) { - Fwrite(buffer, sizeof(buffer[0]), ct, fdo); - } - - if (ct < 0) { - fprintf (stderr, "rpm2cpio: zlib: %s\n", Fstrerror(gzdi)); - rc = EXIT_FAILURE; - } else { - rc = EXIT_SUCCESS; - } - } -#else rc = ufdCopy(gzdi, fdo); rc = (rc <= 0) ? EXIT_FAILURE : EXIT_SUCCESS; Fclose(fdo); -#endif Fclose(gzdi); /* XXX gzdi == fdi */ |