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;
26 fdi =
fdDup(STDIN_FILENO);
28 if (
rstreq(argv[1],
"-h") ||
rstreq(argv[1],
"--help")) {
29 fprintf(stderr,
"Usage: rpm2cpio file.rpm\n");
32 fdi =
Fopen(argv[1],
"r.ufdio");
36 fprintf(stderr,
"%s: %s: %s\n", argv[0],
37 (argc == 1 ?
"<stdin>" : argv[1]),
Fstrerror(fdi));
40 fdo =
fdDup(STDOUT_FILENO);
62 fprintf(stderr,
_(
"argument is not an RPM package\n"));
67 fprintf(stderr,
_(
"error reading header from package\n"));
74 rpmio_flags =
rstrscat(NULL,
"r.", compr ? compr :
"gzip", NULL);
77 gzdi =
Fdopen(fdi, rpmio_flags);
81 fprintf(stderr,
_(
"cannot re-open payload: %s\n"),
Fstrerror(gzdi));
struct _FD_s * FD_t
RPM IO file descriptor type.
int ufdCopy(FD_t sfd, FD_t tfd)
char * rstrscat(char **dest, const char *arg,...) RPM_GNUC_NULL_TERMINATED
Concatenate multiple strings with dynamically (re)allocated memory.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char *fn, Header *hdrp)
Return package header from file handle, verifying digests/signatures.
FD_t Fdopen(FD_t ofd, const char *fmode)
int rpmReadConfigFiles(const char *file, const char *target)
Read macro configuration file(s) for a target.
int Ferror(FD_t fd)
ferror(3) clone.
enum rpmVSFlags_e rpmVSFlags
Bit(s) to control digest and signature verification.
int main(int argc, char *argv[])
static int rstreq(const char *s1, const char *s2)
Test for string equality.
int Fclose(FD_t fd)
fclose(3) clone.
FD_t Fopen(const char *path, const char *fmode)
fopen(3) clone.
#define _RPMVSF_NOSIGNATURES
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct rpmts_s * rpmts
The main types involved in transaction manipulation.
#define _RPMVSF_NODIGESTS
enum rpmRC_e rpmRC
Package read return codes.
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct headerToken_s * Header
RPM header and data retrieval types.