6 #include <rpm/rpmlib.h>
7 #include <rpm/rpmtag.h>
9 #include <rpm/rpmpgp.h>
11 #include <rpm/rpmts.h>
15 int main(
int argc,
char *argv[])
19 char * rpmio_flags = NULL;
27 fdi =
fdDup(STDIN_FILENO);
29 if (
rstreq(argv[1],
"-h") ||
rstreq(argv[1],
"--help")) {
30 fprintf(stderr,
"Usage: rpm2cpio file.rpm\n");
33 fdi =
Fopen(argv[1],
"r.ufdio");
37 fprintf(stderr,
"%s: %s: %s\n", argv[0],
38 (argc == 1 ?
"<stdin>" : argv[1]),
Fstrerror(fdi));
41 fdo =
fdDup(STDOUT_FILENO);
63 fprintf(stderr,
_(
"argument is not an RPM package\n"));
68 fprintf(stderr,
_(
"error reading header from package\n"));
75 rpmio_flags =
rstrscat(NULL,
"r.", compr ? compr :
"gzip", NULL);
79 gzdi =
Fdopen(fdi, rpmio_flags);
83 fprintf(stderr,
_(
"cannot re-open payload: %s\n"),
Fstrerror(gzdi));
87 rc = (
ufdCopy(gzdi, fdo) == payload_size) ? EXIT_SUCCESS : EXIT_FAILURE;
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
rpmts rpmtsCreate(void)
Create an empty transaction set.
int main(int argc, char *argv[])
struct _FD_s * FD_t
RPM IO file descriptor type.
int rpmReadConfigFiles(const char *file, const char *target)
Read macro configuration file(s) for a target.
static int rstreq(const char *s1, const char *s2)
Test for string equality.
char * rstrscat(char **dest, const char *arg,...) RPM_GNUC_NULL_TERMINATED
Concatenate multiple strings with dynamically (re)allocated memory.
FD_t Fdopen(FD_t ofd, const char *fmode)
struct headerToken_s * Header
RPM header and data retrieval types.
off_t ufdCopy(FD_t sfd, FD_t tfd)
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
#define _RPMVSF_NOSIGNATURES
const char * Fstrerror(FD_t fd)
strerror(3) clone.
FD_t Fopen(const char *path, const char *fmode)
fopen(3) clone.
#define _RPMVSF_NODIGESTS
int Ferror(FD_t fd)
ferror(3) clone.
int Fclose(FD_t fd)
fclose(3) clone.