--- psiconv/trunk/program/extra/rewrite.c 2002/01/29 18:38:38 142 +++ psiconv/trunk/program/extra/rewrite.c 2003/12/13 23:26:37 180 @@ -19,7 +19,9 @@ #include #include +#include +#include #include int main(int argc, char *argv[]) @@ -27,13 +29,19 @@ FILE *fp; psiconv_buffer buf; psiconv_file psionfile; + psiconv_config config; /* psiconv_verbosity = PSICONV_VERB_DEBUG; */ if (argc < 3) { fprintf(stderr,"Not enough arguments\n"); + fprintf(stderr,"Syntax: INFILE OUTFILE\n"); exit(1); } + + config = psiconv_config_default(); + psiconv_config_read(NULL,&config); + if (!(fp = fopen(argv[1],"r"))) { perror("Can't open file"); exit(1); @@ -47,14 +55,14 @@ exit(1); } fclose(fp); - if ((psiconv_parse(buf,&psionfile))) { + if ((psiconv_parse(config,buf,&psionfile))) { fprintf(stderr,"Parse error\n"); exit(1); } psiconv_buffer_free(buf); buf = NULL; - if (psiconv_write(&buf,psionfile)) { + if (psiconv_write(config,&buf,psionfile)) { fprintf(stderr,"Generate error\n"); exit(1); } @@ -67,6 +75,7 @@ perror("Can't fwrite file"); exit(1); } + fclose(fp); psiconv_buffer_free(buf); exit(0); }