Back to index

courier  0.68.2
rfc2045xdump.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
00003 ** distribution information.
00004 */
00005 
00006 /*
00007 */
00008 #include      "rfc2045.h"
00009 #include      <stdio.h>
00010 
00011 #define       DUMP(s,n) if ( (s) ) { printf("%*s%s: %s\n", level*4, "", n, (s)); }
00012 
00013 /* Extended RFC2045 dump */
00014 
00015 static void dodump(struct rfc2045 *p, int level)
00016 {
00017        if (!p->isdummy)
00018        {
00019               printf("%*sMessage start %ld, end %ld, startbody %ld, endbody %ld.\n", level*4,
00020                      "", (long)p->startpos, (long)p->endpos,
00021                      (long)p->startbody, (long)p->endbody);
00022               DUMP(p->mime_version, "Mime-Version")
00023               DUMP(p->content_type, "Content-Type")
00024               DUMP(rfc2045_getattr(p->content_type_attr, "charset"),
00025                                                         "Charset")
00026               DUMP(p->content_transfer_encoding, "Transfer Encoding")
00027               DUMP(rfc2045_getattr(p->content_type_attr, "boundary"),
00028                                                         "Boundary")
00029               DUMP(p->content_disposition, "Content Disposition")
00030               DUMP(rfc2045_getattr(p->content_disposition_attr, "name"),
00031                                                  "Disposition Name")
00032               DUMP(rfc2045_getattr(p->content_disposition_attr, "filename"),
00033                                                  "Disposition Filename")
00034        }
00035 
00036        for (p=p->firstpart; p; p=p->next)
00037        {
00038               printf("%*s{\n", level*4, "");
00039               dodump(p, level+1);
00040               printf("%*s}\n", level*4, "");
00041        }
00042 }
00043 
00044 void rfc2045_xdump(struct rfc2045 *p)
00045 {
00046        dodump(p, 0);
00047 }