rfc2045xdump.c
上传用户:s81996212
上传日期:2007-01-04
资源大小:722k
文件大小:1k
源码类别:

WEB邮件程序

开发平台:

C/C++

  1. /*
  2. ** Copyright 1998 - 1999 Double Precision, Inc.  See COPYING for
  3. ** distribution information.
  4. */
  5. /*
  6. ** $Id: rfc2045xdump.c,v 1.4 1999/12/06 13:29:02 mrsam Exp $
  7. */
  8. #include <stdio.h>
  9. #include "rfc2045.h"
  10. #define DUMP(s,n) if ( (s) ) { printf("%*s%s: %sn", level*4, "", n, (s)); }
  11. /* Extended RFC2045 dump */
  12. static void dodump(struct rfc2045 *p, int level)
  13. {
  14. if (!p->isdummy)
  15. {
  16. printf("%*sMessage start %ld, end %ld, startbody %ld, endbody %ld.n", level*4,
  17. "", (long)p->startpos, (long)p->endpos,
  18. (long)p->startbody, (long)p->endbody);
  19. DUMP(p->mime_version, "Mime-Version")
  20. DUMP(p->content_type, "Content-Type")
  21. DUMP(rfc2045_getattr(p->content_type_attr, "charset"),
  22. "Charset")
  23. DUMP(p->content_transfer_encoding, "Transfer Encoding")
  24. DUMP(rfc2045_getattr(p->content_type_attr, "boundary"),
  25. "Boundary")
  26. DUMP(p->content_disposition, "Content Disposition")
  27. DUMP(rfc2045_getattr(p->content_disposition_attr, "name"),
  28. "Disposition Name")
  29. DUMP(rfc2045_getattr(p->content_disposition_attr, "filename"),
  30. "Disposition Filename")
  31. }
  32. for (p=p->firstpart; p; p=p->next)
  33. {
  34. printf("%*s{n", level*4, "");
  35. dodump(p, level+1);
  36. printf("%*s}n", level*4, "");
  37. }
  38. }
  39. void rfc2045_xdump(struct rfc2045 *p)
  40. {
  41. dodump(p, 0);
  42. }