Back to index

opendkim  2.6.2
Defines | Functions | Variables
opendkim-testadsp.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <sysexits.h>
#include <string.h>
#include <dkim.h>
#include <dkim-test.h>

Go to the source code of this file.

Defines

#define BUFRSZ   1024
#define STRORNULL(x)   ((x) == NULL ? "(null)" : (x))

Functions

int usage (void)
int main (int argc, char **argv)

Variables

static char opendkim_testadsp_c_id [] = "@(#)$Id: opendkim-testadsp.c,v 1.8 2010/06/19 15:29:12 cm-msk Exp $"
char * progname

Define Documentation

#define BUFRSZ   1024

Definition at line 29 of file opendkim-testadsp.c.

#define STRORNULL (   x)    ((x) == NULL ? "(null)" : (x))

Definition at line 30 of file opendkim-testadsp.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 67 of file opendkim-testadsp.c.

{
       DKIM_STAT status;
       int i;
       dkim_policy_t pcode;
       int presult;
       DKIM_LIB *lib;
       char *p;
       const char *domain = NULL;
       char err[BUFRSZ];

       progname = (p = strrchr(argv[0], '/')) == NULL ? argv[0] : p + 1;

       lib = dkim_init(NULL, NULL);
       if (lib == NULL)
       {
              fprintf(stderr, "%s: dkim_init() failed\n", progname);
              return EX_OSERR;
       }

       if (argc == 1)
              return usage();

       for (i = 1; i < argc; i++)
       {
              domain = argv[i];

              status = dkim_test_adsp(lib, domain, &pcode, &presult,
                                      err, sizeof err);

              if (status != DKIM_STAT_OK)
              {
                     fprintf(stderr, "%s: %s: %s\n", progname, domain, err);
              }
              else
              {
                     fprintf(stdout,
                             "%s: %s:\n\tpolicy is \"%s\"\n\tpolicy result code is \"%s\"\n",
                             progname, domain,
                             STRORNULL(dkim_getpolicystr(pcode)),
                             STRORNULL(dkim_getpresultstr(presult)));
              }
       }

       (void) dkim_close(lib);

       return EX_OK;
}

Here is the call graph for this function:

int usage ( void  )

Variable Documentation

char opendkim_testadsp_c_id[] = "@(#)$Id: opendkim-testadsp.c,v 1.8 2010/06/19 15:29:12 cm-msk Exp $" [static]

Definition at line 11 of file opendkim-testadsp.c.

char* progname

Definition at line 36 of file opendkim-testadsp.c.