From 1a16df92844a7100e9819168318a2bf32aad94a0 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 6 Jan 2006 22:04:38 +0000 Subject: [PATCH] fix "matchbrackets" breakage git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 2 +- src/chars.c | 4 ++-- src/proto.h | 2 +- src/rcfile.c | 12 +++++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 083e1ec8..f2ed319d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,7 +13,7 @@ CVS code - New functions mbstrpbrk() and mbrevstrpbrk(); changes to find_statusbar_bracket_match(), do_statusbar_find_bracket(), find_bracket_match(), do_find_bracket(), main(), - nanorc.5, and nanorc.sample. (DLR) + parse_rcfile(), nanorc.5, and nanorc.sample. (DLR) - chars.c: mbstrchr() - Make parameter c const. (DLR) diff --git a/src/chars.c b/src/chars.c index 340b6827..bfdaaf62 100644 --- a/src/chars.c +++ b/src/chars.c @@ -927,7 +927,7 @@ char *mbrevstrpbrk(const char *s, const char *accept, const char } #endif /* !NANO_TINY */ -#if !defined(DISABLE_JUSTIFY) && defined(ENABLE_NANORC) +#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)) /* Return TRUE if the string s contains one or more blank characters, * and FALSE otherwise. */ bool has_blank_chars(const char *s) @@ -973,7 +973,7 @@ bool has_blank_mbchars(const char *s) #endif return has_blank_chars(s); } -#endif /* !DISABLE_JUSTIFY && ENABLE_NANORC */ +#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */ #ifdef ENABLE_UTF8 /* Return TRUE if wc is valid Unicode, and FALSE otherwise. */ diff --git a/src/proto.h b/src/proto.h index f93d56f2..a96ea17f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -210,7 +210,7 @@ char *revstrpbrk(const char *s, const char *accept, const char char *mbrevstrpbrk(const char *s, const char *accept, const char *rev_start); #endif -#if !defined(DISABLE_JUSTIFY) && defined(ENABLE_NANORC) +#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)) bool has_blank_chars(const char *s); bool has_blank_mbchars(const char *s); #endif diff --git a/src/rcfile.c b/src/rcfile.c index 7d56909b..120fee9e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -647,7 +647,17 @@ void parse_rcfile(FILE *rcstream) } else #endif #ifndef NANO_TINY - if (strcasecmp(rcopts[i].name, "whitespace") == 0) { + if (strcasecmp(rcopts[i].name, + "matchbrackets") == 0) { + matchbrackets = option; + if (has_blank_mbchars(matchbrackets)) { + rcfile_error( + N_("Non-blank characters required")); + free(matchbrackets); + matchbrackets = NULL; + } + } else if (strcasecmp(rcopts[i].name, + "whitespace") == 0) { whitespace = option; if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) { -- 2.39.5