nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit d08d72a05d84f6687cdb853f685d84f5cc5ecf2d
parent 6e37723fbe9f0588bbf6c62c15a920e263746216
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Fri, 11 Mar 2016 16:51:15 +0000

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

Diffstat:
MChangeLog | 2++
Msrc/rcfile.c | 10+++++-----
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -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' diff --git a/src/rcfile.c b/src/rcfile.c @@ -797,16 +797,16 @@ void grab_and_store(const char *kind, char *ptr, regexlisttype **storage) { regexlisttype *lastthing; - /* The default syntax doesn't take any file matching stuff. */ - if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') { + if (!opensyntax) { rcfile_error( - N_("The \"default\" syntax does not accept '%s' regexes"), kind); + N_("A '%s' command requires a preceding 'syntax' command"), kind); return; } - if (!opensyntax) { + /* The default syntax doesn't take any file matching stuff. */ + if (strcmp(live_syntax->name, "default") == 0 && *ptr != '\0') { rcfile_error( - N_("A '%s' command requires a preceding 'syntax' command"), kind); + N_("The \"default\" syntax does not accept '%s' regexes"), kind); return; }