- if (spec_outfile)
- {
- /* -o was specified. The precise -o name will be used for ftable.
- For other output files, remove the ".c" or ".tab.c" suffix. */
- name_base = spec_outfile;
-#ifdef MSDOS
- strlwr (name_base);
-#endif /* MSDOS */
- /* BASE_LENGTH includes ".tab" but not ".c". */
- base_length = strlen (name_base);
- if (!strcmp (name_base + base_length - 2, ".c"))
- base_length -= 2;
- /* SHORT_BASE_LENGTH includes neither ".tab" nor ".c". */
- short_base_length = base_length;
- if (!strncmp (name_base + short_base_length - 4, ".tab", 4))
- short_base_length -= 4;
- else if (!strncmp (name_base + short_base_length - 4, "_tab", 4))
- short_base_length -= 4;
- }
- else if (spec_file_prefix)
- {
- /* -b was specified. Construct names from it. */
- /* SHORT_BASE_LENGTH includes neither ".tab" nor ".c". */
- short_base_length = strlen (spec_file_prefix);
- /* Count room for `.tab'. */
- base_length = short_base_length + 4;
- name_base = (char *) xmalloc (base_length + 1);
- /* Append `.tab'. */
- strcpy (name_base, spec_file_prefix);
-#ifdef VMS
- strcat (name_base, "_tab");
-#else
- strcat (name_base, ".tab");
-#endif
-#ifdef MSDOS
- strlwr (name_base);
-#endif /* MSDOS */
- }
- else
- {
- /* -o was not specified; compute output file name from input
- or use y.tab.c, etc., if -y was specified. */
-
- name_base = fixed_outfiles ? "y.y" : infile;
-
- /* BASE_LENGTH gets length of NAME_BASE, sans ".y" suffix if any. */
-
- base_length = strlen (name_base);
- if (!strcmp (name_base + base_length - 2, ".y"))
- base_length -= 2;
- short_base_length = base_length;
-
-#ifdef VMS
- name_base = stringappend(name_base, short_base_length, "_tab");
-#else
-#ifdef MSDOS
- name_base = stringappend(name_base, short_base_length, "_tab");
-#else
- name_base = stringappend(name_base, short_base_length, ".tab");
-#endif /* not MSDOS */
-#endif
- base_length = short_base_length + 4;
- }