1 /* rpmarchive: spit out the main archive portion of a package */
19 int main(int argc, char **argv)
31 fd = open(argv[1], O_RDONLY, 0644);
35 perror("cannot open package");
39 rc = pkgReadHeader(fd, &hd, &isSource);
41 fprintf(stderr, "argument is not an RPM package\n");
44 fprintf(stderr, "error reading header from package\n");
48 stream = gzdopen(fd, "r");
50 while ((ct = gzread(stream, &buffer, 1024)) > 0) {
51 write(1, &buffer, ct);
56 gzerror (stream, &zerror);
57 if (zerror == Z_ERRNO){
58 perror ("While uncompressing");
61 fprintf (stderr, "rpm2cpio: zlib: %s error\n", zlib_err [-zerror]);