--- psiconv/trunk/program/extra/rewrite.c 2000/12/25 22:25:33 79 +++ psiconv/trunk/program/extra/rewrite.c 2003/11/23 18:48:55 165 @@ -28,15 +28,18 @@ psiconv_buffer buf; psiconv_file psionfile; + /* psiconv_verbosity = PSICONV_VERB_DEBUG; */ + if (argc < 3) { fprintf(stderr,"Not enough arguments\n"); + fprintf(stderr,"Syntax: INFILE OUTFILE\n"); exit(1); } if (!(fp = fopen(argv[1],"r"))) { perror("Can't open file"); exit(1); } - if (!(buf=psiconv_buffer_new(0))) { + if (!(buf=psiconv_buffer_new())) { perror("Can't allocate buf"); exit(1); } @@ -49,12 +52,14 @@ fprintf(stderr,"Parse error\n"); exit(1); } + psiconv_buffer_free(buf); buf = NULL; if (psiconv_write(&buf,psionfile)) { - fprintf(stderr,"Parse error\n"); + fprintf(stderr,"Generate error\n"); exit(1); } + psiconv_free_file(psionfile); if (!(fp = fopen(argv[2],"w"))) { perror("Can't open file"); exit(1); @@ -63,5 +68,7 @@ perror("Can't fwrite file"); exit(1); } + fclose(fp); + psiconv_buffer_free(buf); exit(0); }