… | |
… | |
19 | */ |
19 | */ |
20 | |
20 | |
21 | #include "config.h" |
21 | #include "config.h" |
22 | #include <stdio.h> |
22 | #include <stdio.h> |
23 | #include <string.h> |
23 | #include <string.h> |
24 | #include "data.h" |
24 | #include "psiconv/data.h" |
25 | #include "list.h" |
25 | #include "psiconv/list.h" |
26 | #include "gen.h" |
26 | #include "gen.h" |
27 | #include "psiconv.h" |
27 | #include "psiconv.h" |
28 | |
28 | |
29 | |
29 | |
30 | /* |
30 | /* |
… | |
… | |
143 | fput_text(of, para->text, strlen(para->text)); |
143 | fput_text(of, para->text, strlen(para->text)); |
144 | fputs("\n\n", of); |
144 | fputs("\n\n", of); |
145 | } |
145 | } |
146 | } |
146 | } |
147 | |
147 | |
148 | static int psiconv_gen_txt(FILE * of, const psiconv_file file, |
148 | static int psiconv_gen_txt(const char *filename, const psiconv_file file, |
149 | const char *dest) |
149 | const char *dest) |
150 | { |
150 | { |
|
|
151 | FILE *of = fopen(filename,"w"); |
|
|
152 | if (! of) |
|
|
153 | return -1; |
|
|
154 | |
151 | if (file->type == psiconv_word_file) { |
155 | if (file->type == psiconv_word_file) { |
152 | psiconv_gen_txt_word(of,(psiconv_word_f) file->file); |
156 | psiconv_gen_txt_word(of,(psiconv_word_f) file->file); |
153 | return 0; |
|
|
154 | } else if (file->type == psiconv_texted_file) { |
157 | } else if (file->type == psiconv_texted_file) { |
155 | psiconv_gen_txt_texted(of,(psiconv_texted_f) file->file); |
158 | psiconv_gen_txt_texted(of,(psiconv_texted_f) file->file); |
156 | return 0; |
|
|
157 | } else |
159 | } else { |
|
|
160 | fclose(of); |
158 | return 1; |
161 | return -1; |
|
|
162 | } |
|
|
163 | return fclose(of); |
159 | } |
164 | } |
160 | |
165 | |
161 | static struct psiconv_fileformat ff = |
166 | static struct psiconv_fileformat_s ff = |
162 | { |
167 | { |
163 | "ASCII", |
168 | "ASCII", |
164 | "Plain text without much layout", |
169 | "Plain text without much layout", |
165 | psiconv_gen_txt |
170 | psiconv_gen_txt |
166 | }; |
171 | }; |