]> git.saurik.com Git - bison.git/blobdiff - src/files.c
* lib/memchr.c, lib/stpcpy.c, lib/strndup.c, lib/strnlen.c:
[bison.git] / src / files.c
index 2e65c5ae3526e832b7715736c18370a8c3108695..eefa188d11cf72140eeb210e04f084acc4d504d1 100644 (file)
 #include "complain.h"
 
 FILE *finput = NULL;
-FILE *foutput = NULL;
 
 struct obstack action_obstack;
 struct obstack attrs_obstack;
 struct obstack table_obstack;
 struct obstack defines_obstack;
 struct obstack guard_obstack;
+struct obstack output_obstack;
 
 char *spec_outfile;    /* for -o. */
 char *spec_file_prefix; /* for -b. */
@@ -245,23 +245,15 @@ compute_base_names (void)
 void
 open_files (void)
 {
-  compute_base_names ();
-
   finput = xfopen (infile, "r");
 
-  if (verbose_flag)
-    /* We used to use just .out if spec_name_prefix (-p) was used, but
-       that conflicts with Posix.  */
-    foutput = xfopen (stringappend (short_base_name, EXT_OUTPUT), "w");
-
-  attrsfile = stringappend (short_base_name, EXT_STYPE_H);
-
   /* Initialize the obstacks. */
   obstack_init (&action_obstack);
   obstack_init (&attrs_obstack);
   obstack_init (&table_obstack);
   obstack_init (&defines_obstack);
   obstack_init (&guard_obstack);
+  obstack_init (&output_obstack);
 }
 
 
@@ -274,7 +266,9 @@ void
 output_files (void)
 {
   xfclose (finput);
-  xfclose (foutput);
+
+  compute_base_names ();
+  attrsfile = stringappend (short_base_name, EXT_STYPE_H);
 
   /* Output the main file.  */
   if (spec_outfile)
@@ -298,4 +292,9 @@ output_files (void)
       obstack_save (&guard_obstack,
                    stringappend (short_base_name, EXT_GUARD_C));
     }
+
+  if (verbose_flag)
+    /* We used to use just .out if spec_name_prefix (-p) was used, but
+       that conflicts with Posix.  */
+    obstack_save (&output_obstack, stringappend (short_base_name, EXT_OUTPUT));
 }