--- psiconv/trunk/program/psiconv/psiconv.c 2000/12/10 16:49:40 58 +++ psiconv/trunk/program/psiconv/psiconv.c 2000/12/25 22:25:33 79 @@ -45,8 +45,6 @@ static void print_version(void); static void strtoupper(char *str); -int psiconv_verbosity = PSICONV_VERB_WARN; - void print_help(void) { psiconv_fileformat ff; @@ -56,7 +54,6 @@ puts("Convert the psion Word file FILE to a HTML file"); puts("If FILE is not specified, use stdin"); puts(" -d, --debug Show debug information on stderr"); - puts(" -e, --exact Quit on any parse errors or warnings"); puts(" -h, --help Display this help and exit"); puts(" -o, --outputfile Output to file instead of stdout"); puts(" -s, --silent Do not even show warnings on stderr"); @@ -97,7 +94,6 @@ {"silent",no_argument,NULL,'s'}, {"outputfile",required_argument,NULL,'o'}, {"type",required_argument,NULL,'T'}, - {"exact",no_argument,NULL,'e'}, {0,0,0,0} }; const char* short_options = "hVvsdo:eT:"; @@ -108,13 +104,14 @@ const char *inputfilename = ""; const char *outputfilename = ""; char *type = strdup("HTML3"); - int exact=0; int c,i,res; psiconv_buffer buf; psiconv_file file; psiconv_fileformat ff; + psiconv_verbosity = PSICONV_VERB_WARN; + fileformat_list = psiconv_list_new(sizeof(struct psiconv_fileformat_s)); init_txt(); init_html(); @@ -133,8 +130,7 @@ psiconv_verbosity = PSICONV_VERB_PROGRESS; break; case 'd': psiconv_verbosity = PSICONV_VERB_DEBUG; break; - case 's': psiconv_verbosity = PSICONV_VERB_SILENT; break; - case 'e': exact = 1; break; + case 's': psiconv_verbosity = PSICONV_VERB_FATAL; break; case 'o': outputfilename = strdup(optarg); break; case 'T': type = strdup(optarg); break; case '?': case ':': fputs("Try `-h' for more information\n",stderr); @@ -151,6 +147,7 @@ } else if (optind == argc-1) inputfilename = strdup(argv[optind]); + /* Open inputfile for reading */ if (strlen(inputfilename) != 0) { @@ -166,9 +163,8 @@ } else f = stdin; - buf = psiconv_list_new(sizeof(psiconv_u8)); - while (! feof(f)) - psiconv_list_fread(buf,1024,f); + buf = psiconv_buffer_new(0); + psiconv_buffer_fread_all(buf,f); if (strlen(inputfilename) != 0) if (fclose(f)) { @@ -176,9 +172,11 @@ exit(1); } - if (psiconv_parse(buf,&file)) - if(exact) - exit(1); + if (psiconv_parse(buf,&file) || (file->type == psiconv_unknown_file)) + { + fprintf(stderr,"Parse error\n"); + exit(1); + } /* Set correct output file */ if (strlen(outputfilename) == 0)