handle all syntaxes without associated colors in parse_rcfile()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3574 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
0b4920adc9
Коммит
558d34f5ba
@ -249,8 +249,6 @@ CVS code -
|
|||||||
parse_argument()
|
parse_argument()
|
||||||
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
|
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
|
||||||
parse_syntax()
|
parse_syntax()
|
||||||
- Properly generate an error if we've read in a previous syntax
|
|
||||||
without any associated color commands. (DLR)
|
|
||||||
- Don't generate an error if we find a duplicate syntax name,
|
- Don't generate an error if we find a duplicate syntax name,
|
||||||
since we might be trying to override a syntax in the global
|
since we might be trying to override a syntax in the global
|
||||||
nanorc with one in our local nanorc. Instead, free any
|
nanorc with one in our local nanorc. Instead, free any
|
||||||
|
12
src/rcfile.c
12
src/rcfile.c
@ -282,11 +282,6 @@ void parse_syntax(char *ptr)
|
|||||||
|
|
||||||
assert(ptr != NULL);
|
assert(ptr != NULL);
|
||||||
|
|
||||||
if (endsyntax != NULL && endcolor == NULL) {
|
|
||||||
rcfile_error(N_("Previous syntax has no color commands"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(N_("Missing syntax name"));
|
rcfile_error(N_("Missing syntax name"));
|
||||||
return;
|
return;
|
||||||
@ -670,9 +665,12 @@ void parse_rcfile(FILE *rcstream
|
|||||||
keyword);
|
keyword);
|
||||||
else
|
else
|
||||||
parse_include(ptr);
|
parse_include(ptr);
|
||||||
} else if (strcasecmp(keyword, "syntax") == 0)
|
} else if (strcasecmp(keyword, "syntax") == 0) {
|
||||||
|
if (endsyntax != NULL && endcolor == NULL)
|
||||||
|
rcfile_error(
|
||||||
|
N_("Previous syntax has no color commands"));
|
||||||
parse_syntax(ptr);
|
parse_syntax(ptr);
|
||||||
else if (strcasecmp(keyword, "color") == 0)
|
} else if (strcasecmp(keyword, "color") == 0)
|
||||||
parse_colors(ptr, FALSE);
|
parse_colors(ptr, FALSE);
|
||||||
else if (strcasecmp(keyword, "icolor") == 0)
|
else if (strcasecmp(keyword, "icolor") == 0)
|
||||||
parse_colors(ptr, TRUE);
|
parse_colors(ptr, TRUE);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user