Back to index

courier  0.68.2
Classes | Defines | Functions
rfc822.h File Reference
#include <time.h>

Go to the source code of this file.

Classes

struct  rfc822token
struct  rfc822addr
struct  rfc822t
struct  rfc822a

Defines

#define RFC822_SPECIALS   "()<>[]:;@\\,.\""
#define rfc822_is_atom(p)   ( (p) == 0 || (p) == '"' || (p) == '(' )
#define CORESUBJ_RE   1
#define CORESUBJ_FWD   2

Functions

struct rfc822trfc822t_alloc_new (const char *p, void(*err_func)(const char *, int, void *), void *)
void rfc822t_free (struct rfc822t *)
void rfc822tok_print (const struct rfc822token *, void(*)(char, void *), void *)
struct rfc822arfc822a_alloc (struct rfc822t *)
void rfc822a_free (struct rfc822a *)
void rfc822_deladdr (struct rfc822a *, int)
int rfc822_print (const struct rfc822a *a, void(*print_func)(char, void *), void(*print_separator)(const char *, void *), void *)
int rfc822_print_common (const struct rfc822a *a, char *(*decode_func)(const char *, const char *, int), const char *chset, void(*print_func)(char, void *), void(*print_separator)(const char *, void *), void *)
char * rfc822_gettok (const struct rfc822token *)
char * rfc822_getaddr (const struct rfc822a *, int)
char * rfc822_getaddrs (const struct rfc822a *)
char * rfc822_getaddrs_wrap (const struct rfc822a *, int)
void rfc822_mkdate_buf (time_t, char *)
const char * rfc822_mkdate (time_t)
time_t rfc822_parsedt (const char *)
char * rfc822_coresubj (const char *, int *)
char * rfc822_coresubj_nouc (const char *, int *)
char * rfc822_coresubj_keepblobs (const char *s)
int rfc822_display_hdrvalue (const char *hdrname, const char *hdrvalue, const char *charset, void(*display_func)(const char *, size_t, void *), void(*err_func)(const char *, int, void *), void *ptr)
char * rfc822_display_hdrvalue_tobuf (const char *hdrname, const char *hdrvalue, const char *charset, void(*err_func)(const char *, int, void *), void *ptr)
int rfc822_display_name (const struct rfc822a *rfcp, int index, const char *chset, void(*print_func)(const char *, size_t, void *), void *ptr)
char * rfc822_display_name_tobuf (const struct rfc822a *rfcp, int index, const char *chset)
int rfc822_display_namelist (const struct rfc822a *rfcp, const char *chset, void(*print_func)(const char *, size_t, void *), void *ptr)
int rfc822_display_addr (const struct rfc822a *rfcp, int index, const char *chset, void(*print_func)(const char *, size_t, void *), void *ptr)
char * rfc822_display_addr_tobuf (const struct rfc822a *rfcp, int index, const char *chset)
int rfc822_display_addr_str (const char *tok, const char *chset, void(*print_func)(const char *, size_t, void *), void *ptr)
char * rfc822_display_addr_str_tobuf (const char *tok, const char *chset)
char * rfc822_encode_domain (const char *address, const char *charset)

Class Documentation

struct rfc822token

Definition at line 30 of file rfc822.h.

Collaboration diagram for rfc822token:
Class Members
int len
struct rfc822token * next
const char * ptr
int token
struct rfc822addr

Definition at line 72 of file rfc822.h.

Collaboration diagram for rfc822addr:
Class Members
struct rfc822token * name
struct rfc822token * tokens
struct rfc822t

Definition at line 83 of file rfc822.h.

Collaboration diagram for rfc822t:
Class Members
int ntokens
struct rfc822token * tokens
struct rfc822a

Definition at line 103 of file rfc822.h.

Collaboration diagram for rfc822a:
Class Members
struct rfc822addr * addrs
int naddrs

Define Documentation

#define CORESUBJ_FWD   2

Definition at line 142 of file rfc822.h.

#define CORESUBJ_RE   1

Definition at line 141 of file rfc822.h.

#define rfc822_is_atom (   p)    ( (p) == 0 || (p) == '"' || (p) == '(' )

Definition at line 43 of file rfc822.h.

#define RFC822_SPECIALS   "()<>[]:;@\\,.\""

Definition at line 21 of file rfc822.h.


Function Documentation

char* rfc822_coresubj ( const char *  ,
int *   
)

Definition at line 251 of file imapsubj.c.

{
       char *q=strdup(s), *r;
       int dummy;

       if (!hasrefwd)
              hasrefwd= &dummy;

       *hasrefwd=0;
       if (!q)       return (0);

       for (r=q; *r; r++)
              if ((*r & 0x80) == 0)       /* Just US-ASCII casing, thanks */
              {
                     if (*r >= 'a' && *r <= 'z')
                            *r += 'A'-'a';
              }
       stripsubj(q, hasrefwd, 0);
       return (q);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_coresubj_keepblobs ( const char *  s)

Definition at line 287 of file imapsubj.c.

{
       char *q=strdup(s), *r;
       int dummy;

       if (!q)       return (0);

       r=strdup(s);
       if (!r)
       {
              free(q);
              return (0);
       }

       stripsubj(q, &dummy, r);
       strcat(r, q);
       free(q);
       return (r);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_coresubj_nouc ( const char *  ,
int *   
)

Definition at line 272 of file imapsubj.c.

{
       char *q=strdup(s);
       int dummy;

       if (!hasrefwd)
              hasrefwd= &dummy;

       *hasrefwd=0;
       if (!q)       return (0);

       stripsubj(q, hasrefwd, 0);
       return (q);
}

Here is the call graph for this function:

void rfc822_deladdr ( struct rfc822a ,
int   
)

Definition at line 774 of file rfc822.c.

{
int    i;

       if (index < 0 || index >= rfcp->naddrs)   return;

       for (i=index+1; i<rfcp->naddrs; i++)
              rfcp->addrs[i-1]=rfcp->addrs[i];
       if (--rfcp->naddrs == 0)
       {
              free(rfcp->addrs);
              rfcp->addrs=0;
       }
}

Here is the caller graph for this function:

int rfc822_display_addr ( const struct rfc822a rfcp,
int  index,
const char *  chset,
void(*)(const char *, size_t, void *)  print_func,
void *  ptr 
)

Definition at line 365 of file rfc2047u.c.

{
       const struct rfc822addr *addrs;
       char *tok;
       int rc;

       if (index < 0 || index >= rfcp->naddrs)   return 0;

       addrs=rfcp->addrs+index;

       if (!addrs->tokens)
              return 0;

       tok=rfc822_gettok(addrs->tokens);

       if (!tok)
              return 0;

       rc=rfc822_display_addr_str(tok, chset, print_func, ptr);
       free(tok);
       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rfc822_display_addr_str ( const char *  tok,
const char *  chset,
void(*)(const char *, size_t, void *)  print_func,
void *  ptr 
)

Definition at line 309 of file rfc2047u.c.

{
       const char *p;

       p=strchr(tok,'@');

       if (!p)
              p=tok;
       else
              ++p;

       if (chset != NULL)
       {
              int err=0;
              char *utf8_ptr;

              if (p > tok)
                     (*print_func)(tok, p-tok, ptr);

#if LIBIDN
              err=idna_to_unicode_8z8z(p, &utf8_ptr, 0);
              if (err != IDNA_SUCCESS)
                     utf8_ptr=0;
#else
              utf8_ptr=0;
#endif

              if (utf8_ptr == 0)
                     (*print_func)(p, strlen(p), ptr);
              else
              {
                     char *q=libmail_u_convert_tobuf(utf8_ptr,
                                                 "utf-8",
                                                 chset, NULL);
                     if (q)
                     {
                            (*print_func)(q, strlen(q), ptr);
                            free(q);
                     }
                     else
                     {
                            (*print_func)(p, strlen(p), ptr);
                     }
                     free(utf8_ptr);
              }
       }
       else
       {
              (*print_func)(tok, strlen(tok), ptr);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_display_addr_str_tobuf ( const char *  tok,
const char *  chset 
)

Definition at line 726 of file rfc2047u.c.

{
       struct rfc822_display_hdrvalue_tobuf_s s;
       int errcode;
       char *bufptr;

       s.cnt=1;

       errcode=rfc822_display_addr_str(tok, chset,
                                   rfc822_display_hdrvalue_tobuf_cnt,
                                   &s);

       if (errcode < 0)
              return NULL;

       bufptr=s.buf=malloc(s.cnt);

       if (!bufptr)
              return NULL;

       errcode=rfc822_display_addr_str(tok, chset,
                                   rfc822_display_hdrvalue_tobuf_save,
                                   &s);
       if (errcode < 0)
       {
              free(bufptr);
              return NULL;
       }
       *s.buf=0;
       return bufptr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_display_addr_tobuf ( const struct rfc822a rfcp,
int  index,
const char *  chset 
)

Definition at line 652 of file rfc2047u.c.

{
       struct rfc822_display_hdrvalue_tobuf_s nbuf;
       int errcode;
       char *ptr;

       nbuf.buf=0;
       nbuf.cnt=1;

       errcode=rfc822_display_addr(rfcp, index, chset,
                                rfc822_display_hdrvalue_tobuf_cnt, &nbuf);

       if (errcode < 0)
              return NULL;

       ptr=nbuf.buf=malloc(nbuf.cnt);
       nbuf.cnt=0;
       if (!ptr)
              return NULL;

       errcode=rfc822_display_addr(rfcp, index, chset,
                                rfc822_display_hdrvalue_tobuf_save, &nbuf);

       if (errcode < 0)
       {
              free(nbuf.buf);
              return NULL;
       }
       *nbuf.buf=0;
       return ptr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rfc822_display_hdrvalue ( const char *  hdrname,
const char *  hdrvalue,
const char *  charset,
void(*)(const char *, size_t, void *)  display_func,
void(*)(const char *, int, void *)  err_func,
void *  ptr 
)

Definition at line 591 of file rfc2047u.c.

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_display_hdrvalue_tobuf ( const char *  hdrname,
const char *  hdrvalue,
const char *  charset,
void(*)(const char *, int, void *)  err_func,
void *  ptr 
)

Definition at line 685 of file rfc2047u.c.

{
       struct rfc822_display_hdrvalue_tobuf_s s;
       int errcode;
       char *bufptr;

       s.orig_err_func=err_func;
       s.orig_ptr=ptr;
       s.cnt=1;

       errcode=rfc822_display_hdrvalue(hdrname, hdrvalue, charset,
                                   rfc822_display_hdrvalue_tobuf_cnt,
                                   rfc822_display_hdrvalue_tobuf_errfunc,
                                   &s);

       if (errcode < 0)
              return NULL;

       bufptr=s.buf=malloc(s.cnt);

       if (!bufptr)
              return NULL;

       errcode=rfc822_display_hdrvalue(hdrname, hdrvalue, charset,
                                   rfc822_display_hdrvalue_tobuf_save,
                                   rfc822_display_hdrvalue_tobuf_errfunc,
                                   &s);
       if (errcode)
       {
              free(bufptr);
              return NULL;
       }
       *s.buf=0;
       return bufptr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rfc822_display_name ( const struct rfc822a rfcp,
int  index,
const char *  chset,
void(*)(const char *, size_t, void *)  print_func,
void *  ptr 
)

Definition at line 242 of file rfc2047u.c.

{
       const struct rfc822addr *addrs;

       if (index < 0 || index >= rfcp->naddrs)   return 0;

       addrs=rfcp->addrs+index;

       if (!addrs->tokens)
              return 0;

       return rfc822_display_name_int(rfcp, index, chset,
                                   print_func, ptr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_display_name_tobuf ( const struct rfc822a rfcp,
int  index,
const char *  chset 
)

Definition at line 260 of file rfc2047u.c.

{
       struct decode_unicode_s s;
       char *p;

       s.bufptr=0;
       s.bufsize=1;

       if (rfc822_display_name(rfcp, index, chset, save_unicode_text, &s) < 0)
              return NULL;
       s.bufptr=p=malloc(s.bufsize);
       if (!p)
              return (0);

       s.bufsize=0;
       if (rfc822_display_name(rfcp, index, chset, save_unicode_text, &s) < 0)
       {
              free(s.bufptr);
              return (0);
       }
       save_unicode_text("", 1, &s);

       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rfc822_display_namelist ( const struct rfc822a rfcp,
const char *  chset,
void(*)(const char *, size_t, void *)  print_func,
void *  ptr 
)

Definition at line 286 of file rfc2047u.c.

{
       int n;

       for (n=0; n<rfcp->naddrs; n++)
       {
              if (rfcp->addrs[n].tokens)
              {
                     int err=rfc822_display_name(rfcp, n, chset,
                                              print_func, ptr);

                     if (err < 0)
                            return err;

                     (*print_func)("\n", 1, ptr);
              }
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_encode_domain ( const char *  address,
const char *  charset 
)

Definition at line 83 of file rfc2047.c.

{
       char *p=libmail_u_convert_tobuf(address, charset, "utf-8", NULL);
       char *cp, *q;

       if (!p)
              return NULL;

       cp=strchr(p, '@');

       if (!cp)
       {
              q=rfc822_encode_domain_int("", 0, p);
              free(p);
              return q;
       }

       ++cp;
       q=rfc822_encode_domain_int(p, cp-p, cp);
       free(p);
       return q;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_getaddr ( const struct rfc822a ,
int   
)

Definition at line 27 of file rfc822_getaddr.c.

{
       return rfc822_display_addr_tobuf(rfc, n, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_getaddrs ( const struct rfc822a )

Definition at line 32 of file rfc822_getaddrs.c.

{
       size_t addrbuflen=0;
       char   *addrbuf, *ptr;

       if (rfc822_print(rfc, &cntlen, &cntlensep, &addrbuflen) < 0)
              return NULL;

       if (!(addrbuf=malloc(addrbuflen+1)))
              return (0);

       ptr=addrbuf;
       if (rfc822_print(rfc, &saveaddr, &saveaddrsep, &ptr) < 0)
       {
              free(addrbuf);
              return NULL;
       }

       addrbuf[addrbuflen]=0;
       return (addrbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_getaddrs_wrap ( const struct rfc822a ,
int   
)

Definition at line 65 of file rfc822_getaddrs.c.

{
       size_t addrbuflen=0;
       char   *addrbuf, *ptr, *start, *lastnl;

       if (rfc822_print(rfc, &cntlen, &cntlensep, &addrbuflen) < 0)
              return NULL;

       if (!(addrbuf=malloc(addrbuflen+1)))
              return (0);

       ptr=addrbuf;

       if (rfc822_print(rfc, &saveaddr, &saveaddrsep_wrap, &ptr) < 0)
       {
              free(addrbuf);
              return NULL;
       }

       addrbuf[addrbuflen]=0;

       for (lastnl=0, start=ptr=addrbuf; *ptr; )
       {
              while (*ptr && *ptr != '\n')       ptr++;
              if (ptr-start < w)
              {
                     if (lastnl)   *lastnl=' ';
                     lastnl=ptr;
                     if (*ptr)     ++ptr;
              }
              else
              {
                     if (lastnl)
                            start=lastnl+1;
                     else
                     {
                            start=ptr+1;
                            if (*ptr)     ++ptr;
                     }
                     lastnl=0;
              }
       }
       return (addrbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* rfc822_gettok ( const struct rfc822token )

Definition at line 32 of file rfc822_getaddr.c.

{
size_t addrbuflen=0;
char   *addrbuf, *ptr;

       rfc822tok_print(t, &cntlen, &addrbuflen);

       if (!(addrbuf=malloc(addrbuflen+1)))
              return (0);

       ptr=addrbuf;
       rfc822tok_print(t, &saveaddr, &ptr);
       addrbuf[addrbuflen]=0;
       return (addrbuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* rfc822_mkdate ( time_t  )

Definition at line 106 of file rfc822_mkdate.c.

{
static char buf[50];

       rfc822_mkdate_buf(t, buf);
       return (buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rfc822_mkdate_buf ( time_t  ,
char *   
)

Definition at line 42 of file rfc822_mkdate.c.

{
struct tm *p;
int    offset;

#if    USE_TIME_ALTZONE

       p=localtime(&t);
       offset= -(int)timezone;

       if (p->tm_isdst > 0)
              offset= -(int)altzone;

       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
#if    USE_TIME_DAYLIGHT

       p=localtime(&t);
       offset= -(int)timezone;

       if (p->tm_isdst > 0)
              offset += 60*60;
       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
#if    USE_TIME_GMTOFF
       p=localtime(&t);
       offset= p->tm_gmtoff;

       if (offset % 60)
       {
              offset=0;
              p=gmtime(&t);
       }
       offset /= 60;
#else
       p=gmtime(&t);
       offset=0;
#endif
#endif
#endif

       offset = (offset % 60) + offset / 60 * 100;

       sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %+05d",
              wdays[p->tm_wday],
              p->tm_mday,
              months[p->tm_mon],
              p->tm_year+1900,
              p->tm_hour,
              p->tm_min,
              p->tm_sec,
              offset);
}

Here is the caller graph for this function:

time_t rfc822_parsedt ( const char *  )

Definition at line 125 of file rfc822_parsedt.c.

{
unsigned day=0, mon=0, year;
int secs;
int offset;
time_t t;
unsigned y;

       /* Ignore day of the week.  Tolerate "Tue, 25 Feb 1997 ... "
       ** without the comma.  Tolerate "Feb 25 1997 ...".
       */

       while (!day || !mon)
       {
              if (!*rfcdt)  return (0);
              if (my_isalpha(*rfcdt))
              {
                     if (mon)      return (0);
                     mon=parsekey(&rfcdt, mnames);
                     if (!mon)
                            while (*rfcdt && my_isalpha(*rfcdt))
                                   ++rfcdt;
                     continue;
              }

              if (my_isdigit(*rfcdt))
              {
                     if (day)      return (0);
                     day=parsedig(&rfcdt);
                     if (!day)     return (0);
                     continue;
              }
              ++rfcdt;
       }

       while (*rfcdt && my_isspace(*rfcdt))
              ++rfcdt;
       if (!my_isdigit(*rfcdt))    return (0);
       year=parsedig(&rfcdt);
       if (year < 70)       year += 2000;
       if (year < 100)      year += 1900;

       while (*rfcdt && my_isspace(*rfcdt))
              ++rfcdt;

       if (day == 0 || mon == 0 || mon > 12 || day > mdays(mon,year))
              return (0);

       secs=parsetime(&rfcdt);
       if (secs < 0) return (0);

       offset=0;

       /* RFC822 sez no parenthesis, but I've seen (EST) */

       while ( *rfcdt )
       {
              if (my_isalnum(*rfcdt) || *rfcdt == '+' || *rfcdt == '-')
                     break;
              ++rfcdt;
       }

       if (my_isalpha((int)(unsigned char)*rfcdt))
       {
       int    n=parsekey(&rfcdt, zonenames);

              if (n > 0)    offset= zoneoffset[n-1];
       }
       else
       {
       int    sign=1;
       unsigned n;

              switch (*rfcdt)      {
              case '-':
                     sign= -1;
              case '+':
                     ++rfcdt;
              }

              if (my_isdigit(*rfcdt))
              {
                     n=parsedig(&rfcdt);
                     if (n > 2359 || (n % 100) > 59)    n=0;
                     offset = sign * ( (n % 100) * 60 + n / 100 * 60 * 60);
              }
       }

       if (year < 1970)     return (0);
       if (year > 9999)     return (0);

       t=0;
       for (y=1970; y<year; y++)
       {
              if ( leap(y) )
              {
                     if (year-y >= 4)
                     {
                            y += 3;
                            t += ( 365*3+366 ) * 24 * 60 * 60;
                            continue;
                     }
                     t += 24 * 60 * 60;
              }
              t += 365 * 24 * 60 * 60;
       }

       for (y=1; y < mon; y++)
              t += mdays(y, year) * 24 * 60 * 60;

       return ( t + (day-1) * 24 * 60 * 60 + secs - offset );
}
int rfc822_print ( const struct rfc822a a,
void(*)(char, void *)  print_func,
void(*)(const char *, void *)  print_separator,
void *   
)
int rfc822_print_common ( const struct rfc822a a,
char *(*)(const char *, const char *, int)  decode_func,
const char *  chset,
void(*)(char, void *)  print_func,
void(*)(const char *, void *)  print_separator,
void *   
)

Definition at line 661 of file rfc822.c.

{
const struct rfc822addr *addrs=rfcp->addrs;
int naddrs=rfcp->naddrs;

       while (naddrs)
       {
              if (addrs->tokens == 0)
              {
                     rfc822tok_print(addrs->name, print_func, ptr);
                     ++addrs;
                     --naddrs;
                     if (addrs[-1].name && naddrs)
                     {
                     struct rfc822token *t;

                            for (t=addrs[-1].name; t && t->next; t=t->next)
                                   ;

                            if (t && (t->token == ':' || t->token == ';'))
                                   (*print_separator)(" ", ptr);
                     }
                     continue;
              }
              else if (addrs->name && addrs->name->token == '(')
              {      /* old style */

                     if (!decode_func)
                     {
                            rfc822tok_print(addrs->tokens, print_func, ptr);
                            (*print_func)(' ', ptr);
                            rfc822tok_print(addrs->name, print_func, ptr);
                     }
                     else
                     {
                            if (rfc822_print_common_nameaddr(addrs,
                                                         decode_func,
                                                         chset,
                                                         print_func,
                                                         ptr) < 0)
                                   return -1;
                     }
              }
              else
              {
                     if (!decode_func)
                     {
                            int    print_braces=0;

                            if (addrs->name)
                            {
                                   rfc822tok_print(addrs->name,
                                                 print_func, ptr);
                                   (*print_func)(' ', ptr);
                                   print_braces=1;
                            }
#if 1
                            else
                            {
                                   struct rfc822token *p;

                                   for (p=addrs->tokens; p && p->next; p=p->next)
                                          if (rfc822_is_atom(p->token) &&
                                              rfc822_is_atom(p->next->token))
                                                 print_braces=1;
                            }
#endif

                            if (print_braces)
                                   (*print_func)('<', ptr);

                            rfc822tok_print(addrs->tokens, print_func, ptr);

                            if (print_braces)
                                   (*print_func)('>', ptr);
                     }
                     else
                     {
                            if (rfc822_print_common_nameaddr(addrs,
                                                         decode_func,
                                                         chset,
                                                         print_func,
                                                         ptr) < 0)
                                   return -1;
                     }
              }
              ++addrs;
              --naddrs;
              if (naddrs)
                     if (addrs->tokens || (addrs->name &&
                            rfc822_is_atom(addrs->name->token)))
                            (*print_separator)(", ", ptr);
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct rfc822a* rfc822a_alloc ( struct rfc822t ) [read]

Definition at line 809 of file rfc822.c.

{
struct rfc822a *p=(struct rfc822a *)malloc(sizeof(struct rfc822a));

       if (!p)       return (NULL);
       memset(p, 0, sizeof(*p));

       parseaddr(t->tokens, t->ntokens, NULL, &p->naddrs);
       p->addrs=p->naddrs ? (struct rfc822addr *)
                     calloc(p->naddrs, sizeof(struct rfc822addr)):0;
       if (p->naddrs && !p->addrs)
       {
              rfc822a_free(p);
              return (NULL);
       }
       parseaddr(t->tokens, t->ntokens, p->addrs, &p->naddrs);
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rfc822a_free ( struct rfc822a )

Definition at line 768 of file rfc822.c.

{
       if (p->addrs) free(p->addrs);
       free(p);
}

Here is the caller graph for this function:

struct rfc822t* rfc822t_alloc_new ( const char *  p,
void(*)(const char *, int, void *)  err_func,
void *   
) [read]

Definition at line 789 of file rfc822.c.

{
struct rfc822t *p=(struct rfc822t *)malloc(sizeof(struct rfc822t));

       if (!p)       return (NULL);
       memset(p, 0, sizeof(*p));

       tokenize(addr, NULL, &p->ntokens, err_func, voidp);
       p->tokens=p->ntokens ? (struct rfc822token *)
                     calloc(p->ntokens, sizeof(struct rfc822token)):0;
       if (p->ntokens && !p->tokens)
       {
              rfc822t_free(p);
              return (NULL);
       }
       tokenize(addr, p->tokens, &p->ntokens, NULL, NULL);
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rfc822t_free ( struct rfc822t )

Definition at line 762 of file rfc822.c.

{
       if (p->tokens)       free(p->tokens);
       free(p);
}

Here is the caller graph for this function:

void rfc822tok_print ( const struct rfc822token ,
void(*)(char, void *)  ,
void *   
)

Definition at line 496 of file rfc822.c.

{
int    prev_isatom=0;
int    isatom;

       while (token)
       {
              isatom=rfc822_is_atom(token->token);
              if (prev_isatom && isatom)
                     (*print_func)(' ', ptr);
              print_token(token, print_func, ptr);
              prev_isatom=isatom;
              token=token->next;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function: