summaryrefslogtreecommitdiff
path: root/tools/rpmlead.c
blob: 4770ea182c355ca6bc4ec7dcfd4ba17ff88fce51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* rpmlead: spit out the lead portion of a package */

#include "system.h"

#include "rpmio.h"
#include "rpmlead.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)) {
	perror(argv[1]);
	exit(EXIT_FAILURE);
    }

    readLead(fdi, &lead);
    fdo = Fopen("-", "w.ufdio");
    writeLead(fdo, &lead);
    
    return 0;
}