source: trunk/third/rpm/rpmio/tring.c @ 17931

Revision 17931, 1.1 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17930, which included commits to RCS files with non-trunk default branches.
Line 
1#include "system.h"
2#include "rpmio_internal.h"
3#include "popt.h"
4#include "debug.h"
5
6static int printing = 1;
7static int _debug = 0;
8
9static struct poptOption optionsTable[] = {
10 { "print", 'p', POPT_ARG_VAL,  &printing, 1,           NULL, NULL },
11 { "noprint", 'n', POPT_ARG_VAL, &printing, 0,          NULL, NULL },
12 { "debug", 'd', POPT_ARG_VAL,  &_debug, -1,            NULL, NULL },
13  POPT_AUTOHELP
14  POPT_TABLEEND
15};
16
17int
18main (int argc, const char *argv[])
19{
20    poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
21    pgpDig dig;
22    const byte * pkt = NULL;
23    ssize_t pktlen;
24    const char ** args;
25    const char * fn;
26    int rc, ec = 0;
27
28    while ((rc = poptGetNextOpt(optCon)) > 0)
29        ;
30
31    if ((args = poptGetArgs(optCon)) != NULL)
32    while ((fn = *args++) != NULL) {
33        pgpArmor pa;
34        pa = pgpReadPkts(fn, &pkt, &pktlen);
35        if (pa == PGPARMOR_ERROR
36         || pa == PGPARMOR_NONE
37         || pkt == NULL || pktlen <= 0)
38        {
39            ec++;
40            continue;
41        }
42
43fprintf(stderr, "===================== %s\n", fn);
44        dig = xcalloc(1, sizeof(*dig));
45        (void) pgpPrtPkts(pkt, pktlen, dig, printing);
46        free((void *)pkt);
47        pkt = NULL;
48        free((void *)dig);
49        dig = NULL;
50    }
51
52    return ec;
53}
Note: See TracBrowser for help on using the repository browser.