- /* If the following section should be named with the yacc-style, and it's
- suffix is of the form 'something.h' or 'something.c', then add '.tab' in
- the middle of the suffix. */
- if (tab_extension && $7 && (strsuffix (suffix, ".h") ||
- strsuffix (suffix, ".c")))
- {
- size_t prefix_len = strlen (prefix);
- size_t suffix_len = strlen (suffix);
-
- /* Allocate enough space to insert '.tab'. */
- name = XMALLOC (char, prefix_len + suffix_len + 5);
- limit = strrchr (suffix, '.');
- if (!limit)
- limit = suffix;
-
- /* Prefix is 'X', suffix is 'Y.Z'. Name will be 'XY.tab.Z'. */
- {
- char* cp = 0;
- cp = stpcpy (name, prefix);
- cp = stpncpy (cp, suffix, limit - suffix);
- cp = stpcpy (cp, ".tab");
- cp = stpcpy (cp, limit);
- }
- }
- else
- name = stringappend (prefix, suffix);
-