summaryrefslogtreecommitdiffstats
path: root/sqwebmail/showmsg2html.c
diff options
context:
space:
mode:
authorSam Varshavchik2013-08-19 16:39:41 -0400
committerSam Varshavchik2013-08-25 14:43:51 -0400
commit9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch)
tree7a81a04cb51efb078ee350859a64be2ebc6b8813 /sqwebmail/showmsg2html.c
parenta9520698b770168d1f33d6301463bb70a19655ec (diff)
downloadcourier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2
Initial checkin
Imported from subversion report, converted to git. Updated all paths in scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'sqwebmail/showmsg2html.c')
-rw-r--r--sqwebmail/showmsg2html.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/sqwebmail/showmsg2html.c b/sqwebmail/showmsg2html.c
new file mode 100644
index 0000000..6021293
--- /dev/null
+++ b/sqwebmail/showmsg2html.c
@@ -0,0 +1,58 @@
+/*
+** Copyright 2011 Double Precision, Inc. See COPYING for
+** distribution information.
+*/
+
+
+/*
+*/
+#include "sqwebmail.h"
+#include "msg2html.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+void rfc2045_error(const char *p)
+{
+ fprintf(stderr, "%s\n", p);
+ exit(1);
+}
+
+void error(const char *p)
+{
+ fprintf(stderr, "%s\n", p);
+ exit(1);
+}
+
+void fake_exit(int rc)
+{
+ exit(rc);
+}
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ struct rfc2045 *rfc;
+ struct msg2html_info *info;
+
+ if (argc < 2)
+ return 0;
+
+ if ((fp=fopen(argv[1], "r")) == NULL)
+ {
+ perror(argv[1]);
+ exit(1);
+ }
+
+ rfc=rfc2045_fromfp(fp);
+
+ info=msg2html_alloc("utf-8");
+ info->showhtml=1;
+ msg2html(fp, rfc, info);
+ fclose(fp);
+ msg2html_free(info);
+ rfc2045_free(rfc);
+ return (0);
+}