- /* These are opened by `done' or `open_extra_files', if at all */
- if (spec_outfile)
- tabfile = spec_outfile;
- else
- tabfile = stringappend (name_base, base_length, ".c");
+ If --yacc is used, do as if the input file was `y.y'. */
+ {
+ const char *name_base = yacc_flag ? "y.y" : infile;
+
+ /* BASE_LENGTH gets length of BASE_NAME, sans ".y" suffix if any. */
+
+ base_length = strlen (name_base);
+
+ ext_index = get_extension_index (name_base);
+ /* if the initial segment of extension contains a 'y' or a 'Y', I assume
+ that it is a yacc or bison grammar file */
+ if (ext_index)
+ ext_index = (strspn(name_base + ext_index + 1, "yY")) ? ext_index : 0;
+ if (ext_index)
+ {
+ base_length -= strlen (name_base + ext_index);
+ compute_exts_from_gf(name_base + ext_index);
+ }
+
+ short_base_length = base_length;
+ short_base_name = strndup (name_base, short_base_length);
+
+ base_name = XMALLOC (char,
+ strlen (short_base_name) + strlen (EXT_TAB) + 1);
+ stpcpy (stpcpy (base_name, short_base_name), EXT_TAB);
+
+ return;
+ }
+}
+
+/*-----------------------------------------------------------------.
+| Open the input file. Look for the skeletons. Find the names of |
+| the output files. Prepare the obstacks. |
+`-----------------------------------------------------------------*/