Back to index

courier  0.68.2
showmsg2html.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2011 Double Precision, Inc.  See COPYING for
00003 ** distribution information.
00004 */
00005 
00006 
00007 /*
00008 */
00009 #include      "sqwebmail.h"
00010 #include      "msg2html.h"
00011 
00012 #include      <stdio.h>
00013 #include      <stdlib.h>
00014 #include      <string.h>
00015 #include      <errno.h>
00016 
00017 void rfc2045_error(const char *p)
00018 {
00019        fprintf(stderr, "%s\n", p);
00020        exit(1);
00021 }
00022 
00023 void error(const char *p)
00024 {
00025        fprintf(stderr, "%s\n", p);
00026        exit(1);
00027 }
00028 
00029 void fake_exit(int rc)
00030 {
00031        exit(rc);
00032 }
00033 
00034 int main(int argc, char **argv)
00035 {
00036        FILE *fp;
00037        struct rfc2045 *rfc;
00038        struct msg2html_info *info;
00039 
00040        if (argc < 2)
00041               return 0;
00042 
00043        if ((fp=fopen(argv[1], "r")) == NULL)
00044        {
00045               perror(argv[1]);
00046               exit(1);
00047        }
00048 
00049        rfc=rfc2045_fromfp(fp);
00050 
00051        info=msg2html_alloc("utf-8");
00052        info->showhtml=1;
00053        msg2html(fp, rfc, info);
00054        fclose(fp);
00055        msg2html_free(info);
00056        rfc2045_free(rfc);
00057        return (0);
00058 }