Main Page Modules Data Structures File List Data Fields Globals Related Pages

# tools/rpmsignature.c

Go to the documentation of this file.

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