Back to index

courier  0.68.2
Functions
testrfc3676parser.c File Reference
#include "rfc3676parser.h"
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

static int line_begin (size_t quote_level, void *arg)
static int line_contents (const unicode_char *txt, size_t txt_size, void *arg)
static int line_flowed_notify (void *arg)
static int line_end (void *arg)
int main (int argc, char **argv)

Function Documentation

static int line_begin ( size_t  quote_level,
void *  arg 
) [static]

Definition at line 12 of file testrfc3676parser.c.

{
       printf("[%d: ", (int)quote_level);
       return 0;
}

Here is the caller graph for this function:

static int line_contents ( const unicode_char txt,
size_t  txt_size,
void *  arg 
) [static]

Definition at line 18 of file testrfc3676parser.c.

{
       while (txt_size--)
              putchar(*txt++);
       return 0;
}

Here is the caller graph for this function:

static int line_end ( void *  arg) [static]

Definition at line 33 of file testrfc3676parser.c.

{
       printf("]\n");
       return 0;
}

Here is the caller graph for this function:

static int line_flowed_notify ( void *  arg) [static]

Definition at line 27 of file testrfc3676parser.c.

{
       printf("...");
       return 0;
}

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file testrfc3676parser.c.

{
       struct rfc3676_parser_info info;
       int n=0;
       char buf[BUFSIZ];
       rfc3676_parser_t parser;

       if (argc > 1)
              n=atoi(argv[1]);

       memset(&info, 0, sizeof(info));

       info.charset="utf-8";

       info.isflowed=n != 0;
       info.isdelsp= n == 2;

       info.line_begin=line_begin;
       info.line_contents=line_contents;
       info.line_flowed_notify=line_flowed_notify;
       info.line_end=line_end;

       if ((parser=rfc3676parser_init(&info)) != NULL)
       {
              while (fgets(buf, sizeof(buf), stdin))
                     rfc3676parser(parser, buf, strlen(buf));
              rfc3676parser_deinit(parser, NULL);
              printf("\n");
       }

       return (0);
}

Here is the call graph for this function: