summaryrefslogtreecommitdiff
path: root/devel/ruby-byaccr/patches/patch-af
blob: 8136834d1a24bc8aba17c222fcd1dbbc810b1c3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
$NetBSD: patch-af,v 1.2 2005/06/19 20:44:06 minskim Exp $

--- output.c.orig	2000-11-14 02:42:19.000000000 -0600
+++ output.c
@@ -1,6 +1,5 @@
 #include <stdio.h>
 #include <string.h>
-#include <malloc.h>
 
 #include "defs.h"
 
@@ -834,9 +833,7 @@ void output_defines(void)
 	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 +873,17 @@ void output_defines(void)
 
     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 +897,17 @@ void output_stored_text(void)
 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 +923,12 @@ FILE *in, *out;
 	    ++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 +1207,6 @@ char **symnam, *s;
 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 +1327,12 @@ FILE *in, *out;
 	++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 +1341,17 @@ void output_semantic_actions(void)
 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 +1377,12 @@ FILE *out;
 	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)