--- psiconv/trunk/program/psiconv/psiconv.c 1999/12/04 21:46:45 46 +++ psiconv/trunk/program/psiconv/psiconv.c 2000/10/21 00:49:13 53 @@ -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);