- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# 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 "rpmlead.h"
    00006 #include "signature.h"
    00007 #include "debug.h"
    00008
    00009 int main(int argc, char **argv)
    00010 {
    00011     FD_t fdi, fdo;
    00012     struct rpmlead lead;
    00013     Header sig;
    00014
    00015     setprogname(argv[0]);       /* Retrofit glibc __progname */
    00016     if (argc == 1) {
    00017         fdi = Fopen("-", "r.ufdio");
    00018     } else {
    00019         fdi = Fopen(argv[1], "r.ufdio");
    00020     }
    00021     if (Ferror(fdi)) {
    00022         fprintf(stderr, "%s: %s: %s\n", argv[0],
    00023                 (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
    00024         exit(1);
    00025     }
    00026
    00027     readLead(fdi, &lead);
    00028     rpmReadSignature(fdi, &sig, lead.signature_type);
    00029     switch (lead.signature_type) {
    00030     case RPMSIGTYPE_NONE:
    00031         fprintf(stderr, _("No signature available.\n"));
    00032         break;
    00033     default:
    00034         fdo = Fopen("-", "w.ufdio");
    00035         rpmWriteSignature(fdo, sig);
    00036         break;
    00037     }
    00038
    00039     return 0;
    00040 }