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));
92 rc = (
ufdCopy(gzdi, fdo) >= payload_size) ? EXIT_SUCCESS : EXIT_FAILURE;
off_t ufdCopy(FD_t sfd, FD_t tfd)
struct _FD_s * FD_t
RPM IO file descriptor type.
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.
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
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct headerToken_s * Header
RPM header and data retrieval types.