1 /*
2 ** Copyright 2011 Double Precision, Inc.  See COPYING for
3 ** distribution information.
4 */
5 
6 
7 /*
8 */
9 #include	"sqwebmail.h"
10 #include	"msg2html.h"
11 
12 #include	<stdio.h>
13 #include	<stdlib.h>
14 #include	<string.h>
15 #include	<errno.h>
16 
rfc2045_error(const char * p)17 void rfc2045_error(const char *p)
18 {
19 	fprintf(stderr, "%s\n", p);
20 	exit(1);
21 }
22 
error(const char * p)23 void error(const char *p)
24 {
25 	fprintf(stderr, "%s\n", p);
26 	exit(1);
27 }
28 
fake_exit(int rc)29 void fake_exit(int rc)
30 {
31 	exit(rc);
32 }
33 
main(int argc,char ** argv)34 int main(int argc, char **argv)
35 {
36 	FILE *fp;
37 	struct rfc2045 *rfc;
38 	struct msg2html_info *info;
39 
40 	if (argc < 2)
41 		return 0;
42 
43 	if ((fp=fopen(argv[1], "r")) == NULL)
44 	{
45 		perror(argv[1]);
46 		exit(1);
47 	}
48 
49 	rfc=rfc2045_fromfp(fp);
50 
51 	info=msg2html_alloc("utf-8");
52 	info->showhtml=1;
53 	msg2html(fp, rfc, info);
54 	fclose(fp);
55 	msg2html_free(info);
56 	rfc2045_free(rfc);
57 	return (0);
58 }
59