Checking for an open syntax first, before checking it is named "default".

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5721 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-11 16:51:15 +00:00
parent 6e37723fbe
commit d08d72a05d
2 changed files with 8 additions and 6 deletions

View File

@ -3,6 +3,8 @@
--enable-tiny plus --enable-browser.
* src/rcfile.c: Tweak some comments and reshuffle some lines.
* src/rcfile.c (color_to_short): Elide a variable.
* src/rcfile.c (grab_and_store): First check that there is an
open syntax before checking that it is named "default".
2016-03-10 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'

View File

@ -797,6 +797,12 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
{
regexlisttype *lastthing;
if (!opensyntax) {
rcfile_error(
N_("A '%s' command requires a preceding 'syntax' command"), kind);
return;
}
/* The default syntax doesn't take any file matching stuff. */
if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') {
rcfile_error(
@ -804,12 +810,6 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage)
return;
}
if (!opensyntax) {
rcfile_error(
N_("A '%s' command requires a preceding 'syntax' command"), kind);
return;
}
if (*ptr == '\0') {
rcfile_error(N_("Missing regex string after '%s' command"), kind);
return;