]> git.saurik.com Git - bison.git/blobdiff - src/files.c
Add src/system.h; this isn't really needed, but it keeps "make update"
[bison.git] / src / files.c
index dd3ec8180a68eb72f0c143939ac46029300a90f0..7815e37ddf008b15d30fb2db94a2f34cda48aaf0 100644 (file)
@@ -57,10 +57,6 @@ static char *full_base_name = NULL;
 /* Prefix used to generate output file names.  */
 char *short_base_name = NULL;
 
-/* Infix used to generate output file names (i.e., `.tab', or `_tab',
-   or `').  */
-char *output_infix = NULL;
-
 /* C source file extension (the parser source).  */
 const char *src_extension = NULL;
 /* Header file extension (if option ``-d'' is specified).  */
@@ -111,7 +107,7 @@ xfopen (const char *name, const char *mode)
 
   ptr = fopen (name, mode);
   if (!ptr)
-    error (2, errno, _("cannot open file `%s'"), name);
+    error (EXIT_FAILURE, errno, _("cannot open file `%s'"), name);
 
   return ptr;
 }
@@ -120,19 +116,17 @@ xfopen (const char *name, const char *mode)
 | Try to close file PTR, and print an error message if fails.  |
 `-------------------------------------------------------------*/
 
-int
+void
 xfclose (FILE *ptr)
 {
-  int result;
-
   if (ptr == NULL)
-    return 0;
+    return;
 
-  result = fclose (ptr);
-  if (result == EOF)
-    error (2, errno, _("cannot close file"));
+  if (ferror (ptr))
+    error (EXIT_FAILURE, 0, _("I/O error"));
 
-  return result;
+  if (fclose (ptr) != 0)
+    error (EXIT_FAILURE, errno, _("cannot close file"));
 }
 \f
 
@@ -260,10 +254,6 @@ compute_base_names (void)
                  (strlen (spec_outfile)
                   - (tab ? strlen (tab) : (ext ? strlen (ext) : 0))));
 
-      if (tab)
-       output_infix = xstrndup (tab,
-                                (strlen (tab) - (ext ? strlen (ext) : 0)));
-
       if (ext)
        compute_exts_from_src (ext);
     }
@@ -295,9 +285,6 @@ compute_base_names (void)
                      (strlen (base) - (ext ? strlen (ext) : 0)));
        }
 
-      /* In these cases, always append `.tab'. */
-      output_infix = xstrdup (EXT_TAB);
-
       full_base_name = XMALLOC (char,
                                strlen (short_base_name)
                                + strlen (EXT_TAB) + 1);