tests/ep/test_ep.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following functions.
  1. main

   1 #include <stdio.h>
   2 #include <errno.h>
   3 
   4 #include "ca_configFns.h"
   5 #include "ca_dictSyms.h"
   6 #include "ca_macros.h"
   7 #include "ca_srcAttribs.h"
   8 #include "gpg.h"
   9 #include "mail_parser.h"
  10 
  11 extern char EP_outputPrefix[FILENAME_LENGTH];
  12 extern char EP_keyRing[FILENAME_LENGTH];
  13 extern int  EP_TreeHeight;
  14 extern int  EP_Node_ID;
  15 extern int EP_Debug;
  16 
  17 int main(int argc, char **argv)
     /* [<][>][^][v][top][bottom][index][help] */
  18 {
  19 
  20   char iSignedFilename[100] = "foo.asc";
  21   char iSignatureFilename[100] = "";
  22   char iImportKeyFilename[100] = "goo";
  23   char iKeyRing[100] = "/home/filippo/.gnupg/pubring.gpg";
  24   struct VerifySignObject vSO, *pvSO;
  25   struct ImportKeyObject iKO;
  26   EP_Mail_DescrPtr p; 
  27   EPTokenPtr pt;
  28   char *local_ca__tmpdir;
  29 
  30  /* config stuff */
  31   ca_populateDictionary(dictionary, VARS);
  32   /* if -c flag is given, use the named file as config file, otherwise use
  33      default filename */
  34   ca_readConfig("filippo.conf", confVars, VARS);
  35   
  36   
  37   if ((argv[1] != NULL) && (argv[2] != NULL) 
  38       && (!strcmp(argv[1], "-f"))) {
  39 
  40     local_ca__tmpdir = g_strstrip(ca_get_tmpdir);
  41     
  42     free(local_ca__tmpdir);
  43 
  44     p = EP_ParseMail(argv[2], "/tmp/filippo", 
  45                      "/home/filippo/.gnupg/pubring.gpg");
  46     EP_ShowTree(p->tree);  
  47     
  48     pt = EP_GetTokens(p->tree, NULL, NULL);
  49 
  50     EP_PrintTokens(pt);
  51     
  52     EP_CleanTokens(pt);  
  53 
  54     EP_MailDescrCleanUp(p);
  55   } else 
  56     if (argv[1] != NULL) {
  57       EPNodePtr ptr;
  58       char hostname[1024];
  59       int retcode;
  60       long debug = 10;
  61       char mail_file[1024];
  62       
  63       EP_Debug = debug;
  64       
  65       gethostname(hostname, MAXHOSTNAMELEN);
  66       sprintf(EP_outputPrefix, "%s/EPtmp.%s.%ld.", "/tmp/filippo",
  67               hostname, getpid());
  68       
  69       strcpy(EP_keyRing, "/home/filippo/.gnupg/pubring.gpg");
  70       
  71       ptr = EP_InitializeRootNode(argv[1]);
  72       
  73       PA_ParseMessage(ptr);
  74       
  75     }
  76   
  77   return 0;
  78 }

/* [<][>][^][v][top][bottom][index][help] */