1 /* rpmarchive: spit out the main archive portion of a package */
18 int main(int argc, char **argv)
30 fd = open(argv[1], O_RDONLY, 0644);
34 perror("cannot open package");
38 rc = rpmReadPackageHeader(fd, &hd, &isSource, NULL, NULL);
40 fprintf(stderr, "argument is not an RPM package\n");
43 fprintf(stderr, "error reading header from package\n");
47 stream = gzdopen(fd, "r");
49 while ((ct = gzread(stream, &buffer, 1024)) > 0) {
50 write(1, &buffer, ct);
55 gzerror (stream, &zerror);
56 if (zerror == Z_ERRNO){
57 perror ("While uncompressing");
61 fprintf (stderr, "rpm2cpio: zlib: %s error\n", zlib_err [-zerror - 1]);