32 lines
650 B
C
32 lines
650 B
C
|
/* rpmlead: spit out the lead portion of a package */
|
||
|
|
||
|
#include "system.h"
|
||
|
|
||
|
#include "rpmio.h"
|
||
|
#include "rpmlead.h"
|
||
|
#include "debug.h"
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
FD_t fdi, fdo;
|
||
|
struct rpmlead lead;
|
||
|
|
||
|
setprogname(argv[0]); /* Retrofit glibc __progname */
|
||
|
if (argc == 1) {
|
||
|
fdi = Fopen("-", "r.ufdio");
|
||
|
} else {
|
||
|
fdi = Fopen(argv[1], "r.ufdio");
|
||
|
}
|
||
|
if (fdi == NULL || Ferror(fdi)) {
|
||
|
fprintf(stderr, "%s: %s: %s\n", argv[0],
|
||
|
(argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
|
||
|
exit(EXIT_FAILURE);
|
||
|
}
|
||
|
|
||
|
readLead(fdi, &lead);
|
||
|
fdo = Fopen("-", "w.ufdio");
|
||
|
writeLead(fdo, &lead);
|
||
|
|
||
|
return 0;
|
||
|
}
|