1 /* rpmarchive: spit out the main archive portion of a package */
17 int main(int argc, char **argv)
29 fd = open(argv[1], O_RDONLY, 0644);
33 perror("cannot open package");
37 rc = rpmReadPackageHeader(fd, &hd, &isSource, NULL, NULL);
39 fprintf(stderr, _("argument is not an RPM package\n"));
42 fprintf(stderr, _("error reading header from package\n"));
46 stream = gzdopen(fd, "r");
48 while ((ct = gzread(stream, &buffer, 1024)) > 0) {
49 write(1, &buffer, ct);
54 gzerror (stream, &zerror);
55 if (zerror == Z_ERRNO){
56 perror ("While uncompressing");
60 fprintf (stderr, "rpm2cpio: zlib: %s error\n", zlib_err [-zerror - 1]);