mirror of git://git.sv.gnu.org/nano.git
rcfile: report the correct command location for an invalid 'include'
For each included file, save and restore file name and line number of the including file, so that an error message about a faulty 'include' command can indicate the location of this 'include'. This fixes https://savannah.gnu.org/bugs/?56488. Signed-off-by: Brand Huntsman <alpha@qzx.com>
This commit is contained in:
parent
a2f7e31ba2
commit
82f5fed45a
|
@ -560,6 +560,8 @@ bool is_good_file(char *file)
|
|||
/* Read and parse one included syntax file. */
|
||||
void parse_one_include(char *file, syntaxtype *syntax)
|
||||
{
|
||||
char *was_nanorc = nanorc;
|
||||
size_t was_lineno = lineno;
|
||||
augmentstruct *extra;
|
||||
FILE *rcstream;
|
||||
|
||||
|
@ -583,6 +585,8 @@ void parse_one_include(char *file, syntaxtype *syntax)
|
|||
/* If this is the first pass, parse only the prologue. */
|
||||
if (syntax == NULL) {
|
||||
parse_rcfile(rcstream, TRUE, TRUE);
|
||||
nanorc = was_nanorc;
|
||||
lineno = was_lineno;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -610,6 +614,9 @@ void parse_one_include(char *file, syntaxtype *syntax)
|
|||
|
||||
free(syntax->filename);
|
||||
syntax->filename = NULL;
|
||||
|
||||
nanorc = was_nanorc;
|
||||
lineno = was_lineno;
|
||||
}
|
||||
|
||||
/* Expand globs in the passed name, and parse the resultant files. */
|
||||
|
|
Loading…
Reference in New Issue