Back to index

courier  0.68.2
Functions | Variables
maildirkwtest.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "maildir/maildirkeywords.h"

Go to the source code of this file.

Functions

static int count_flags (struct libmail_keywordEntry *dummy1, void *dummy)
static int dump ()
int main ()

Variables

static struct libmail_kwHashtable
int smapflag = 0
static struct libmail_kwMessagemsgs [3]
static const char *const flags [] = {"apple", "banana", "pear", "grape"}

Function Documentation

static int count_flags ( struct libmail_keywordEntry dummy1,
void *  dummy 
) [static]

Definition at line 22 of file maildirkwtest.c.

{
       ++*(size_t *)dummy;

       return 0;
}

Here is the caller graph for this function:

static int dump ( ) [static]

Definition at line 33 of file maildirkwtest.c.

{
       size_t cnt=0;

       if (libmail_kwEnumerate(&h, &count_flags, &cnt))
              return -1;

       printf("%d flags\n", (int)cnt);

       for (cnt=0; cnt<sizeof(msgs)/sizeof(msgs[0]); cnt++)
       {
              struct libmail_kwMessageEntry *e;

              printf("%d:", (int)cnt);

              for (e=msgs[cnt]->firstEntry; e; e=e->next)
                     printf(" %s", keywordName(e->libmail_keywordEntryPtr));
              printf("\n");
       }
       return 0;

}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( )

Definition at line 56 of file maildirkwtest.c.

{
       size_t i;

       libmail_kwhInit(&h);

       for (i=0; i<sizeof(msgs)/sizeof(msgs[0]); i++)
       {
              if ((msgs[i]=libmail_kwmCreate()) == NULL)
              {
                     perror("malloc");
                     exit(1);
              }

              msgs[i]->u.userNum=i;
       }

       if (libmail_kwmSetName(&h, msgs[0], flags[0]) >= 0 &&
           libmail_kwmSetName(&h, msgs[1], flags[1]) >= 0 &&
           libmail_kwmSetName(&h, msgs[2], flags[2]) >= 0 &&
           libmail_kwmSetName(&h, msgs[0], flags[0]) >= 0 &&
           libmail_kwmSetName(&h, msgs[0], flags[1]) >= 0 &&
           libmail_kwmSetName(&h, msgs[1], flags[2]) >= 0 &&
           libmail_kwmSetName(&h, msgs[2], flags[3]) >= 0)
       {

              if (dump() == 0)
              {
                     libmail_kwmClearName(msgs[2], flags[3]);
                     libmail_kwmClearName(msgs[2], flags[3]);
                     libmail_kwmClearName(msgs[0], flags[1]);

                     if (dump() == 0)
                            exit(0);
              }

       }

       perror("ERROR");
       exit(1);
       return 0;
}

Here is the call graph for this function:


Variable Documentation

const char* const flags[] = {"apple", "banana", "pear", "grape"} [static]

Definition at line 30 of file maildirkwtest.c.

struct libmail_kwHashtable [static]

Definition at line 18 of file maildirkwtest.c.

struct libmail_kwMessage* msgs[3] [static]

Definition at line 29 of file maildirkwtest.c.

int smapflag = 0

Definition at line 20 of file maildirkwtest.c.