Back to index

courier  0.68.2
Defines | Enumerations | Functions | Variables
rfc2045acprep.c File Reference
#include "rfc2045.h"
#include <ctype.h>
#include <string.h>

Go to the source code of this file.

Defines

#define h2nyb(c)

Enumerations

enum  state_t {
  raw, quotedprint, qpseeneq, qpseeneqh,
  base64
}

Functions

static void start_rwprep (struct rfc2045 *)
static void do_rwprep (const char *, size_t)
static void end_rwprep ()
struct rfc2045rfc2045_alloc_ac ()

Variables

static struct rfc2045ac
static struct rfc2045currwp
static int curlinepos = 0
static state_t curstate
static int statechar

Define Documentation

#define h2nyb (   c)
Value:
( (c) >= 'a' && (c) <= 'f' ? (c)-('a'-10): \
                 (c) >= 'A' && (c) <= 'F' ? (c)-('A'-10): (c)-'0')

Definition at line 33 of file rfc2045acprep.c.


Enumeration Type Documentation

enum state_t
Enumerator:
raw 
quotedprint 
qpseeneq 
qpseeneqh 
base64 

Definition at line 23 of file rfc2045acprep.c.


Function Documentation

static void do_rwprep ( const char *  p,
size_t  n 
) [static]

Definition at line 61 of file rfc2045acprep.c.

{
       if (!currwp)  return;
       for ( ; n; --n, ++p)
              switch (curstate)    {
              case quotedprint:
                     if (*p == '=')
                     {
                            curstate=qpseeneq;
                            continue;
                     }
                     /* FALLTHRU */
              case raw:
                     if (*p == '\r' || *p == '\n')
                            curlinepos=0;
                     else if (++curlinepos > 500)
                            currwp->haslongline=1;
                     if ((unsigned char)*p >= 127)
                            currwp->has8bitchars=1;
                     break;
              case qpseeneq:
                     if (*p == '\n')
                     {
                            curstate=quotedprint;
                            continue;
                     }
                     if (isspace((int)(unsigned char)*p))      continue; /* Ignore WSP */
                     statechar=*p;
                     curstate=qpseeneqh;
                     continue;
              case qpseeneqh:
                     curstate=quotedprint;
                     if ( (unsigned char)
                            ( (h2nyb(statechar) << 4) + h2nyb(*p) ) >= 127
                            ) currwp->has8bitchars=1;
                     if (++curlinepos > 500)
                            currwp->haslongline=1;
                     continue;
              case base64:
                     break;
              }
}
static void end_rwprep ( ) [static]

Definition at line 104 of file rfc2045acprep.c.

{
}
struct rfc2045* rfc2045_alloc_ac ( ) [read]

Definition at line 36 of file rfc2045acprep.c.

{
struct rfc2045 *p=rfc2045_alloc();

       if (p) p->rfc2045acptr= &rfc2045acprep;
       currwp=0;
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void start_rwprep ( struct rfc2045 p) [static]

Definition at line 46 of file rfc2045acprep.c.

{
       currwp=p;
       curlinepos=0;
       curstate=raw;
       if (p->content_transfer_encoding)
       {
              if (strcmp(p->content_transfer_encoding,
                     "quoted-printable") == 0)
                     curstate=quotedprint;
              else if (strcmp(p->content_transfer_encoding, "base64") == 0)
                     curstate=base64;
       }
}

Variable Documentation

int curlinepos = 0 [static]

Definition at line 21 of file rfc2045acprep.c.

struct rfc2045* currwp [static]

Definition at line 20 of file rfc2045acprep.c.

state_t curstate [static]

Definition at line 30 of file rfc2045acprep.c.

struct rfc2045ac [static]
Initial value:

Definition at line 15 of file rfc2045acprep.c.

int statechar [static]

Definition at line 31 of file rfc2045acprep.c.