+ if (xml_flag)
+ {
+ if (! spec_xml_file)
+ spec_xml_file = concat2 (all_but_tab_ext, ".xml");
+ output_file_name_check (spec_xml_file);
+ }
+
+ if (report_flag)
+ {
+ if (!spec_verbose_file)
+ spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
+ output_file_name_check (spec_verbose_file);
+ }
+
+ free (all_but_tab_ext);
+ free (src_extension);
+ free (header_extension);
+}
+
+void
+output_file_name_check (char const *file_name)
+{
+ if (0 == strcmp (file_name, grammar_file))
+ fatal (_("refusing to overwrite the input file %s"), quote (file_name));
+ {
+ int i;
+ for (i = 0; i < file_names_count; i++)
+ if (0 == strcmp (file_names[i], file_name))
+ warn (_("conflicting outputs to file %s"), quote (file_name));
+ }
+ file_names = xnrealloc (file_names, ++file_names_count, sizeof *file_names);
+ file_names[file_names_count-1] = xstrdup (file_name);
+}
+
+void
+output_file_names_free (void)
+{
+ free (all_but_ext);
+ free (spec_verbose_file);
+ free (spec_graph_file);
+ free (spec_xml_file);
+ free (spec_defines_file);
+ free (parser_file_name);
+ free (dir_prefix);
+ {
+ int i;
+ for (i = 0; i < file_names_count; i++)
+ free (file_names[i]);
+ }
+ free (file_names);