Back to index

courier  0.68.2
headercheck.c
Go to the documentation of this file.
00001 #include "rfc2045_config.h"
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include "rfc2045.h"
00005 
00006 void rfc2045_error(const char *s)
00007 {
00008        printf("%s\n", s);
00009        exit(0);
00010 }
00011 
00012 int main(int argc, char **argv)
00013 {
00014        struct rfc2045src *src;
00015        struct rfc2045 *rfcp;
00016        struct rfc2045headerinfo *hi;
00017        char *h, *v;
00018 
00019        if (argc < 3)
00020               return (0);
00021 
00022        rfcp=rfc2045_fromfd(0);
00023 
00024        if (!rfcp)
00025               return (0);
00026 
00027        if (argv[2][0])
00028               rfcp=rfc2045_find(rfcp, argv[2]);
00029 
00030        src=rfc2045src_init_fd(0);
00031 
00032        if (!src)
00033               return (0);
00034 
00035        hi=rfc2045header_start(src, rfcp);
00036 
00037        if (!hi)
00038               return (0);
00039 
00040        while (rfc2045header_get(hi, &h, &v, atoi(argv[1])) == 0)
00041        {
00042               if (h == NULL)
00043                      break;
00044               printf("Header: %s\n", h);
00045               printf("Value: %s\n", v);
00046        }
00047        return (0);
00048 }