]> git.saurik.com Git - bison.git/blobdiff - src/files.c
* bootstrap (runtime-po/Makevars): Derive from po/Makevars
[bison.git] / src / files.c
index 4acf9e898935196df6e2ee12837b9ddd081719e2..ecb31738f9534c8a51518cbdf53088d4f82455a2 100644 (file)
@@ -1,7 +1,7 @@
 /* Open and close files for Bison.
 
 /* Open and close files for Bison.
 
-   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
 
    This file is part of Bison, the GNU Compiler Compiler.
 
    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
-
+#include <config.h>
 #include "system.h"
 
 #include <error.h>
 #include "system.h"
 
 #include <error.h>
+#include <dirname.h>
 #include <get-errno.h>
 #include <quote.h>
 #include <get-errno.h>
 #include <quote.h>
+#include <stdio-safer.h>
 #include <xstrndup.h>
 
 #include "complain.h"
 #include <xstrndup.h>
 
 #include "complain.h"
-#include "dirname.h"
 #include "files.h"
 #include "getargs.h"
 #include "gram.h"
 #include "files.h"
 #include "getargs.h"
 #include "gram.h"
-#include "stdio-safer.h"
 
 struct obstack pre_prologue_obstack;
 struct obstack post_prologue_obstack;
 
 struct obstack pre_prologue_obstack;
 struct obstack post_prologue_obstack;
@@ -208,7 +208,7 @@ static void
 file_name_split (const char *file_name,
                 const char **base, const char **tab, const char **ext)
 {
 file_name_split (const char *file_name,
                 const char **base, const char **tab, const char **ext)
 {
-  *base = base_name (file_name);
+  *base = last_component (file_name);
 
   /* Look for the extension, i.e., look for the last dot. */
   *ext = strrchr (*base, '.');
 
   /* Look for the extension, i.e., look for the last dot. */
   *ext = strrchr (*base, '.');
@@ -263,25 +263,23 @@ compute_file_name_parts (void)
 
       if (spec_file_prefix)
        {
 
       if (spec_file_prefix)
        {
-         /* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT =
-            `foo'.  */
-         dir_prefix = xstrndup (grammar_file, base - grammar_file);
-         all_but_tab_ext = xstrdup (spec_file_prefix);
+         /* If --file-prefix=foo was specified, ALL_BUT_TAB_EXT = `foo'.  */
+         dir_prefix = xstrndup (grammar_file, base - grammar_file);
+         all_but_tab_ext = xstrdup (spec_file_prefix);
        }
       else if (yacc_flag)
        {
        }
       else if (yacc_flag)
        {
-         /* If --yacc, then the output is `y.tab.c'. */
-         dir_prefix = "";
-         all_but_tab_ext = "y";
+         /* If --yacc, then the output is `y.tab.c'.  */
+         dir_prefix = "";
+         all_but_tab_ext = "y";
        }
       else
        {
        }
       else
        {
-         /* Otherwise, ALL_BUT_TAB_EXT is computed from the input
+         /* Otherwise, ALL_BUT_TAB_EXT is computed from the input
             grammar: `foo/bar.yy' => `bar'.  */
             grammar: `foo/bar.yy' => `bar'.  */
-         dir_prefix = "";
-         all_but_tab_ext =
-           xstrndup (base,
-                     (strlen (base) - (ext ? strlen (ext) : 0)));
+         dir_prefix = "";
+         all_but_tab_ext =
+           xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
        }
 
       all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
        }
 
       all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
@@ -318,14 +316,14 @@ compute_output_file_names (void)
   if (defines_flag)
     {
       if (! spec_defines_file)
   if (defines_flag)
     {
       if (! spec_defines_file)
-       spec_defines_file = concat2 (all_but_ext, header_extension);
+       spec_defines_file = concat2 (all_but_ext, header_extension);
       name[names++] = spec_defines_file;
     }
 
   if (graph_flag)
     {
       if (! spec_graph_file)
       name[names++] = spec_defines_file;
     }
 
   if (graph_flag)
     {
       if (! spec_graph_file)
-       spec_graph_file = concat2 (all_but_tab_ext, ".vcg");
+       spec_graph_file = concat2 (all_but_tab_ext, ".dot");
       name[names++] = spec_graph_file;
     }
 
       name[names++] = spec_graph_file;
     }