… | |
… | |
47 | #ifdef HAVE_UNISTD_H |
47 | #ifdef HAVE_UNISTD_H |
48 | #include <unistd.h> |
48 | #include <unistd.h> |
49 | #endif |
49 | #endif |
50 | |
50 | |
51 | #ifdef IMAGEMAGICK |
51 | #ifdef IMAGEMAGICK |
52 | #include <magick/magick.h> |
52 | #include "magick-aux.h" |
53 | #endif |
53 | #endif |
54 | |
54 | |
55 | #include "psiconv/data.h" |
55 | #include "psiconv/data.h" |
56 | #include "psiconv/parse.h" |
56 | #include "psiconv/parse.h" |
|
|
57 | #include "psiconv/configuration.h" |
57 | #include "gen.h" |
58 | #include "gen.h" |
58 | #include "psiconv.h" |
59 | #include "psiconv.h" |
59 | |
60 | |
60 | static void print_help(void); |
61 | static void print_help(void); |
61 | static void print_version(void); |
62 | static void print_version(void); |
… | |
… | |
130 | int c,i,res; |
131 | int c,i,res; |
131 | psiconv_buffer buf; |
132 | psiconv_buffer buf; |
132 | psiconv_file file; |
133 | psiconv_file file; |
133 | psiconv_fileformat ff; |
134 | psiconv_fileformat ff; |
134 | |
135 | |
135 | psiconv_verbosity = PSICONV_VERB_WARN; |
136 | psiconv_config config = psiconv_config_read(NULL); |
136 | |
137 | |
137 | fileformat_list = psiconv_list_new(sizeof(struct psiconv_fileformat_s)); |
138 | fileformat_list = psiconv_list_new(sizeof(struct psiconv_fileformat_s)); |
138 | init_txt(); |
139 | init_txt(); |
139 | init_html(); |
140 | init_html(); |
140 | init_html4(); |
141 | init_html4(); |
… | |
… | |
147 | if (c == -1) |
148 | if (c == -1) |
148 | break; |
149 | break; |
149 | switch(c) { |
150 | switch(c) { |
150 | case 'h': print_help(); exit(0); |
151 | case 'h': print_help(); exit(0); |
151 | case 'V': print_version(); exit(0); |
152 | case 'V': print_version(); exit(0); |
152 | case 'v': if (psiconv_verbosity < PSICONV_VERB_PROGRESS) |
153 | case 'v': if (config->verbosity < PSICONV_VERB_PROGRESS) |
153 | psiconv_verbosity = PSICONV_VERB_PROGRESS; |
154 | config->verbosity = PSICONV_VERB_PROGRESS; |
154 | break; |
155 | break; |
155 | case 'd': psiconv_verbosity = PSICONV_VERB_DEBUG; break; |
156 | case 'd': config->verbosity = PSICONV_VERB_DEBUG; break; |
156 | case 's': psiconv_verbosity = PSICONV_VERB_FATAL; break; |
157 | case 's': config->verbosity = PSICONV_VERB_FATAL; break; |
157 | case 'o': outputfilename = strdup(optarg); break; |
158 | case 'o': outputfilename = strdup(optarg); break; |
158 | case 'T': type = strdup(optarg); break; |
159 | case 'T': type = strdup(optarg); break; |
159 | case 'u': encoding_type = PSICONV_ENCODING_UTF8; break; |
160 | case 'u': encoding_type = PSICONV_ENCODING_UTF8; break; |
160 | case '?': case ':': fputs("Try `-h' for more information\n",stderr); |
161 | case '?': case ':': fputs("Try `-h' for more information\n",stderr); |
161 | exit(1); |
162 | exit(1); |
… | |
… | |
194 | if (fclose(f)) { |
195 | if (fclose(f)) { |
195 | perror(inputfilename); |
196 | perror(inputfilename); |
196 | exit(1); |
197 | exit(1); |
197 | } |
198 | } |
198 | |
199 | |
199 | if (psiconv_parse(buf,&file) || (file->type == psiconv_unknown_file)) |
200 | if (psiconv_parse(config,buf,&file) || (file->type == psiconv_unknown_file)) |
200 | { |
201 | { |
201 | fprintf(stderr,"Parse error\n"); |
202 | fprintf(stderr,"Parse error\n"); |
202 | exit(1); |
203 | exit(1); |
203 | } |
204 | } |
204 | |
205 | |