$NetBSD: patch-af,v 1.1.1.1 2001/07/01 14:39:15 taca Exp $ --- output.c.orig Tue Nov 14 17:42:19 2000 +++ output.c @@ -834,9 +834,7 @@ s = symbol_name[i]; if (is_C_identifier(s)) { - if (jflag) /*rwj*/ - fprintf(code_file, ""); - else + if (!jflag) /*rwj*/ fprintf(code_file, "#define "); if (dflag) fprintf(defines_file, "#define "); c = *s; @@ -876,8 +874,17 @@ if (dflag && unionized) { +#ifdef WITHOUT_MKSTEMP fclose(union_file); union_file = fopen(union_file_name, "r"); +#else + if (fflush(union_file) == 0) + rewind(union_file); + else { + fclose(union_file); + union_file = NULL; + } +#endif if (union_file == NULL) open_error(union_file_name); while ((c = getc(union_file)) != EOF) putc(c, defines_file); @@ -891,8 +898,17 @@ int c; FILE *in, *out; +#ifdef WITHOUT_MKSTEMP fclose(text_file); text_file = fopen(text_file_name, "r"); +#else + if (fflush(text_file) == 0) + rewind(text_file); + else { + fclose(text_file); + text_file = NULL; + } +#endif if (text_file == NULL) open_error(text_file_name); in = text_file; @@ -908,11 +924,12 @@ ++outline; putc(c, out); } - if (!lflag) + if (!lflag) { if (jflag)/*rwj*/ fprintf(out, jline_format, ++outline + 1, code_file_name); else fprintf(out, line_format, ++outline + 1, code_file_name); + } } @@ -1191,8 +1208,6 @@ void output_stype(void) { int prim; /*is the Ruby semantic type a primitive?*/ -char filenam[128]; -FILE *f; if (jflag){ /*rwj*/ prim=0; fprintf(code_file,"\n\n"); @@ -1313,11 +1328,12 @@ ++outline; putc('\n', out); } - if (!lflag) + if (!lflag) { if (jflag) fprintf(out, jline_format, ++outline + 1, code_file_name); else fprintf(out, line_format, ++outline + 1, code_file_name); + } } @@ -1326,8 +1342,17 @@ int c, last; FILE *out; +#ifdef WITHOUT_MKSTEMP fclose(action_file); action_file = fopen(action_file_name, "r"); +#else + if (fflush(action_file) == 0) + rewind(action_file); + else { + fclose(action_file); + action_file = NULL; + } +#endif if (action_file == NULL) open_error(action_file_name); @@ -1353,11 +1378,12 @@ putc('\n', out); } - if (!lflag) + if (!lflag) { if (jflag)/*rwj*/ fprintf(out, jline_format, ++outline + 1, code_file_name); else fprintf(out, line_format, ++outline + 1, code_file_name); + } } void free_itemsets(void)