--- psiconv/trunk/program/psiconv/gen_rtf.c 1999/10/11 19:17:17 14 +++ psiconv/trunk/program/psiconv/gen_rtf.c 2000/10/21 00:49:13 53 @@ -19,11 +19,13 @@ */ #include "config.h" +#include "compat.h" #include #include #include "data.h" #include "list.h" #include "gen.h" +#include "psiconv.h" /* @@ -327,7 +329,7 @@ { struct psiconv_color white = { 0,0,0 }; struct psiconv_color black = { 0xff,0xff,0xff }; - struct psiconv_font font = { strdup(""),-1 }; /* Pseudo - not added! */ + struct psiconv_font font = { NULL,-1 }; /* Pseudo - not added! */ struct psiconv_character_layout base_char_struct = { @@ -342,13 +344,14 @@ &font, /* font */ }; + font.name = strdup(""); add_color(colors,&white); add_color(colors,&black); return psiconv_clone_character_layout(&base_char_struct); } -void diff_char(FILE *of,psiconv_list colors, psiconv_list fonts, +static void diff_char(FILE *of,psiconv_list colors, psiconv_list fonts, const psiconv_character_layout old, const psiconv_character_layout new) { @@ -519,13 +522,33 @@ psiconv_list_free(colors); } -void psiconv_gen_rtf(FILE * of, psiconv_file file) +static int psiconv_gen_rtf(const char *filename, const psiconv_file file, + const char *dest) { - if (file->type == psiconv_word_file) + FILE *of = fopen(filename,"w"); + if (! of) + return -1; + + if (file->type == psiconv_word_file) { psiconv_gen_rtf_word(of,(psiconv_word_f) file->file); - else if (file->type == psiconv_texted_file) + } else if (file->type == psiconv_texted_file) { psiconv_gen_rtf_texted(of,(psiconv_texted_f) file->file); - else - return; + } else { + fclose(of); + return -1; + } + return fclose(of); +} + +static struct psiconv_fileformat ff = +{ + "RTF", + "Rich Text Format (not functional yet!)", + psiconv_gen_rtf +}; + +void init_rtf(void) +{ + /* psiconv_list_add(fileformat_list,&ff); */ }