X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/72cd9a913f6d282c5e24990505c2c820bda2bf1b..e36ec1f41ffbe9f00db405c775201dbbc384c45c:/src/files.c diff --git a/src/files.c b/src/files.c index 550e42ed..7fea3064 100644 --- a/src/files.c +++ b/src/files.c @@ -134,6 +134,18 @@ xfclose (FILE *ptr) } +FILE * +xfdopen (int fd, char const *mode) +{ + FILE *res = fdopen (fd, mode); + if (! res) + error (EXIT_FAILURE, get_errno (), + // On a separate line to please the "unmarked_diagnostics" + // syntax-check. + "fdopen"); + return res; +} + /*------------------------------------------------------------------. | Compute ALL_BUT_EXT, ALL_BUT_TAB_EXT and output files extensions. | `------------------------------------------------------------------*/ @@ -207,7 +219,7 @@ file_name_split (const char *file_name, *base = last_component (file_name); /* Look for the extension, i.e., look for the last dot. */ - *ext = mbsrchr (*base, '.'); + *ext = strrchr (*base, '.'); *tab = NULL; /* If there is an extension, check if there is a `.tab' part right @@ -348,7 +360,7 @@ output_file_name_check (char **file_name) bool conflict = false; if (STREQ (*file_name, grammar_file)) { - complain (_("refusing to overwrite the input file %s"), + complain (NULL, complaint, _("refusing to overwrite the input file %s"), quote (*file_name)); conflict = true; } @@ -358,8 +370,8 @@ output_file_name_check (char **file_name) for (i = 0; i < file_names_count; i++) if (STREQ (file_names[i], *file_name)) { - warn (_("conflicting outputs to file %s"), - quote (*file_name)); + complain (NULL, Wother, _("conflicting outputs to file %s"), + quote (*file_name)); conflict = true; } }