Back to index

courier  0.68.2
Classes | Functions
rwint.h File Reference
#include "courier.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rwmsginfo

Functions

void rw_rewrite_msg_init (struct rwmsginfo *, int(*)(const char *p, unsigned l, void *), void(*)(struct rw_info *, void(*)(struct rw_info *), void *), void *)
int rw_rewrite_msg_finish (struct rwmsginfo *)
int rw_rewrite_msgheaders (const char *, unsigned, struct rwmsginfo *)

Function Documentation

int rw_rewrite_msg_finish ( struct rwmsginfo )

Definition at line 28 of file comrwmsg.c.

{
int    j=0;

       while (rwinfo->inheaders)
       {
              if (rw_rewrite_msgheaders("\n", 1, rwinfo))
              {
                     j= -1;
                     break;
              }
       }

       if (rwinfo->headerbuf)
              free(rwinfo->headerbuf);
       return (j);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rw_rewrite_msg_init ( struct rwmsginfo ,
int(*)(const char *p, unsigned l, void *)  ,
void(*)(struct rw_info *, void(*)(struct rw_info *), void *)  ,
void *   
)

Definition at line 14 of file comrwmsg.c.

{
       memset(rwinfo, 0, sizeof(*rwinfo));

       rwinfo->inheaders=1;
       rwinfo->writefunc=writefunc;
       rwinfo->rewritefunc=rewritefunc;
       rwinfo->arg=arg;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rw_rewrite_msgheaders ( const char *  ,
unsigned  ,
struct rwmsginfo  
)

Definition at line 49 of file comrwmsg.c.

{
       while (msginfo->inheaders)
       {
              if (l == 0)   return (0);

              while (l)
              {
              unsigned i;

                     if (*p == '\n')
                     {
                            if (msginfo->lastnl)
                            {
                                   if (dorewriteheader(msginfo))
                                          return (-1);
                                   msginfo->inheaders=0;
                                   break;
                            }
                            add2header(p, 1, msginfo);
                            msginfo->lastnl=1;
                            ++p;
                            --l;
                            continue;
                     }

                     if (msginfo->lastnl)
                     {
                            if (!isspace((int)(unsigned char)*p))
                                   if (dorewriteheader(msginfo))
                                          return (-1);
                            msginfo->lastnl=0;
                     }

                     for (i=0; i < l; i++)
                            if (p[i] == '\n')
                                   break;
                     add2header(p, i, msginfo);
                     p += i;
                     l -= i;
              }
       }

       return ((*msginfo->writefunc)(p, l, msginfo->arg));
}

Here is the call graph for this function:

Here is the caller graph for this function: