--- psiconv/trunk/program/psiconv/psiconv.c 1999/12/02 17:18:55 34 +++ psiconv/trunk/program/psiconv/psiconv.c 2000/12/10 15:44:40 56 @@ -107,7 +107,7 @@ const char *inputfilename = ""; const char *outputfilename = ""; - char *type = strdup("HTML"); + char *type = strdup("HTML3"); int exact=0; int c,i,res; @@ -115,7 +115,7 @@ psiconv_file file; psiconv_fileformat ff; - fileformat_list = psiconv_list_new(sizeof(struct psiconv_fileformat)); + fileformat_list = psiconv_list_new(sizeof(struct psiconv_fileformat_s)); init_txt(); init_html(); init_html4(); @@ -180,22 +180,15 @@ if(exact) exit(1); - /* Open outputfile for writing */ - if (strlen(outputfilename) != 0) { - f = fopen(outputfilename,"w"); - if (! f) { - perror(outputfilename); - exit(1); - } - } else - f = stdout; + /* Set correct output file */ + if (strlen(outputfilename) == 0) + outputfilename = "/dev/stdout"; - strtoupper(type); for (i = 0; i < psiconv_list_length(fileformat_list); i ++) { ff = psiconv_list_get(fileformat_list,i); if (! strcmp(type,ff->name)) { - res = ff->output(f,file,type); + res = ff->output(outputfilename,file,type); if (res) { fprintf(stderr, "Output format `%s' not permitted for this file type\n",type); @@ -210,12 +203,6 @@ exit(1); } - if (strlen(outputfilename) != 0) - if (fclose(f)) { - perror(outputfilename); - exit(1); - } - psiconv_free_file(file); exit(0);