# tools/rpmlead.c

Go to the documentation of this file.

    00001 /* rpmlead: spit out the lead portion of a package */
    00002
    00003 #include "system.h"
    00004
    00005 #include "rpmio.h"
    00006 #include "rpmlead.h"
    00007 #include "debug.h"
    00008
    00009 int main(int argc, char **argv)
    00010 {
    00011     FD_t fdi, fdo;
    00012     struct rpmlead lead;
    00013
    00014     setprogname(argv[0]);       /* Retrofit glibc __progname */
    00015     if (argc == 1) {
    00016         fdi = Fopen("-", "r.ufdio");
    00017     } else {
    00018         fdi = Fopen(argv[1], "r.ufdio");
    00019     }
    00020     if (fdi == NULL || Ferror(fdi)) {
    00021         fprintf(stderr, "%s: %s: %s\n", argv[0],
    00022                 (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
    00023         exit(EXIT_FAILURE);
    00024     }
    00025
    00026     readLead(fdi, &lead);
    00027     fdo = Fopen("-", "w.ufdio");
    00028     writeLead(fdo, &lead);
    00029
    00030     return 0;
    00031 }