summaryrefslogtreecommitdiffstats
path: root/rfc2045/rfc2045xdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'rfc2045/rfc2045xdump.c')
-rw-r--r--rfc2045/rfc2045xdump.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/rfc2045/rfc2045xdump.c b/rfc2045/rfc2045xdump.c
new file mode 100644
index 0000000..f1f96eb
--- /dev/null
+++ b/rfc2045/rfc2045xdump.c
@@ -0,0 +1,47 @@
+/*
+** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
+** distribution information.
+*/
+
+/*
+*/
+#include "rfc2045.h"
+#include <stdio.h>
+
+#define DUMP(s,n) if ( (s) ) { printf("%*s%s: %s\n", level*4, "", n, (s)); }
+
+/* Extended RFC2045 dump */
+
+static void dodump(struct rfc2045 *p, int level)
+{
+ if (!p->isdummy)
+ {
+ printf("%*sMessage start %ld, end %ld, startbody %ld, endbody %ld.\n", level*4,
+ "", (long)p->startpos, (long)p->endpos,
+ (long)p->startbody, (long)p->endbody);
+ DUMP(p->mime_version, "Mime-Version")
+ DUMP(p->content_type, "Content-Type")
+ DUMP(rfc2045_getattr(p->content_type_attr, "charset"),
+ "Charset")
+ DUMP(p->content_transfer_encoding, "Transfer Encoding")
+ DUMP(rfc2045_getattr(p->content_type_attr, "boundary"),
+ "Boundary")
+ DUMP(p->content_disposition, "Content Disposition")
+ DUMP(rfc2045_getattr(p->content_disposition_attr, "name"),
+ "Disposition Name")
+ DUMP(rfc2045_getattr(p->content_disposition_attr, "filename"),
+ "Disposition Filename")
+ }
+
+ for (p=p->firstpart; p; p=p->next)
+ {
+ printf("%*s{\n", level*4, "");
+ dodump(p, level+1);
+ printf("%*s}\n", level*4, "");
+ }
+}
+
+void rfc2045_xdump(struct rfc2045 *p)
+{
+ dodump(p, 0);
+}