1 /* rpmarchive: spit out the main archive portion of a package */
8 #include "lib/package.h"
20 int main(int argc, char **argv)
32 fd = open(argv[1], O_RDONLY, 0644);
36 perror("cannot open package");
40 rc = pkgReadHeader(fd, &hd, &isSource);
42 fprintf(stderr, "argument is not an RPM package\n");
45 fprintf(stderr, "error reading header from package\n");
49 stream = gzdopen(fd, "r");
51 while ((ct = gzread(stream, &buffer, 1024)) > 0) {
52 write(1, &buffer, ct);
57 gzerror (stream, &zerror);
58 if (zerror == Z_ERRNO){
59 perror ("While uncompressing");
62 fprintf (stderr, "rpm2cpio: zlib: %s error\n", zlib_err [-zerror]);