1 /* rpmarchive: spit out the main archive portion of a package */
7 int main(int argc, char **argv)
16 setprogname(argv[0]); /* Retrofit glibc __progname */
18 fdi = fdDup(STDIN_FILENO);
20 fdi = Fopen(argv[1], "r.ufdio");
23 if (Fileno(fdi) < 0) {
24 perror("cannot open package");
27 fdo = fdDup(STDOUT_FILENO);
29 rc = rpmReadPackageHeader(fdi, &hd, &isSource, NULL, NULL);
34 fprintf(stderr, _("argument is not an RPM package\n"));
38 fprintf(stderr, _("error reading header from package\n"));
44 gzdi = gzdFdopen(fdi, "r"); /* XXX gzdi == fdi */
46 gzdi = Fdopen(fdi, "r.gzdio"); /* XXX gzdi == fdi */
49 while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) {
50 Fwrite(buffer, sizeof(buffer[0]), ct, fdo);
54 fprintf (stderr, "rpm2cpio: zlib: %s\n", Fstrerror(gzdi));
60 Fclose(gzdi); /* XXX gzdi == fdi */