summaryrefslogtreecommitdiffstats
path: root/sqwebmail/showmsg2html.c
blob: 60212931a68184cca9aeaf0cc1e1b9b59671a002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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);
}