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 = ufdio->open(argv[1], O_RDONLY, 0644);
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"));
43 gzdi = gzdFdopen(fdi, "r"); /* XXX gzdi == fdi */
45 while ((ct = Fread(buffer, sizeof(buffer), 1, gzdi)) > 0) {
46 Fwrite(buffer, ct, 1, fdo);
50 fprintf (stderr, "rpm2cpio: zlib: %s\n", Fstrerror(gzdi));
56 Fclose(gzdi); /* XXX gzdi == fdi */