~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to tools/rpmsignature.c

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* rpmsignature: spit out the signature portion of a package */
 
2
 
 
3
#include "system.h"
 
4
 
 
5
#include "rpmlead.h"
 
6
#include "signature.h"
 
7
#include "debug.h"
 
8
 
 
9
int main(int argc, char **argv)
 
10
{
 
11
    FD_t fdi, fdo;
 
12
    struct rpmlead lead;
 
13
    Header sig;
 
14
    
 
15
    setprogname(argv[0]);       /* Retrofit glibc __progname */
 
16
    if (argc == 1) {
 
17
        fdi = Fopen("-", "r.ufdio");
 
18
    } else {
 
19
        fdi = Fopen(argv[1], "r.ufdio");
 
20
    }
 
21
    if (Ferror(fdi)) {
 
22
        fprintf(stderr, "%s: %s: %s\n", argv[0],
 
23
                (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi));
 
24
        exit(1);
 
25
    }
 
26
 
 
27
    readLead(fdi, &lead);
 
28
    rpmReadSignature(fdi, &sig, lead.signature_type);
 
29
    switch (lead.signature_type) {
 
30
    case RPMSIGTYPE_NONE:
 
31
        fprintf(stderr, _("No signature available.\n"));
 
32
        break;
 
33
    default:
 
34
        fdo = Fopen("-", "w.ufdio");
 
35
        rpmWriteSignature(fdo, sig);
 
36
        break;
 
37
    }
 
38
    
 
39
    return 0;
 
40
}