00001 #include "system.h" 00002 #include "rpmio_internal.h" 00003 #include "popt.h" 00004 #include "debug.h" 00005 00006 static int printing = 1; 00007 static int _debug = 0; 00008 00009 static struct poptOption optionsTable[] = { 00010 { "print", 'p', POPT_ARG_VAL, &printing, 1, NULL, NULL }, 00011 { "noprint", 'n', POPT_ARG_VAL, &printing, 0, NULL, NULL }, 00012 { "debug", 'd', POPT_ARG_VAL, &_debug, -1, NULL, NULL }, 00013 { "ftpdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_ftp_debug, -1, 00014 N_("debug protocol data stream"), NULL}, 00015 { "rpmiodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmio_debug, -1, 00016 N_("debug rpmio I/O"), NULL}, 00017 { "urldebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_url_debug, -1, 00018 N_("debug URL cache handling"), NULL}, 00019 { "verbose", 'v', 0, 0, 'v', NULL, NULL }, 00020 POPT_AUTOHELP 00021 POPT_TABLEEND 00022 }; 00023 00024 int 00025 main (int argc, const char *argv[]) 00026 { 00027 poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0); 00028 pgpDig dig; 00029 const byte * pkt = NULL; 00030 ssize_t pktlen; 00031 const char ** args; 00032 const char * fn; 00033 int rc, ec = 0; 00034 00035 while ((rc = poptGetNextOpt(optCon)) > 0) 00036 ; 00037 00038 if ((args = poptGetArgs(optCon)) != NULL) 00039 while ((fn = *args++) != NULL) { 00040 pgpArmor pa; 00041 00042 pa = pgpReadPkts(fn, &pkt, &pktlen); 00043 if (pa == PGPARMOR_ERROR 00044 || pa == PGPARMOR_NONE 00045 || pkt == NULL || pktlen <= 0) 00046 { 00047 ec++; 00048 continue; 00049 } 00050 00051 fprintf(stderr, "===================== %s\n", fn); 00052 dig = xcalloc(1, sizeof(*dig)); 00053 (void) pgpPrtPkts(pkt, pktlen, dig, printing); 00054 free((void *)pkt); 00055 pkt = NULL; 00056 free((void *)dig); 00057 dig = NULL; 00058 } 00059 00060 return ec; 00061 }