nano

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

commit 0cd833e64bcdffbac9ec63f6c0c05fe6be4c4541
parent cbf226476df3747aa25520800c69b12606f6b304
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 30 Mar 2018 10:25:39 +0200

tweaks: move a function to its proper location

Put it after the function that it calls, and before the functions
it is called from.

Diffstat:
Msrc/proto.h | 1-
Msrc/rcfile.c | 56++++++++++++++++++++++++++++----------------------------
2 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/proto.h b/src/proto.h @@ -471,7 +471,6 @@ int do_yesno_prompt(bool all, const char *msg); /* Most functions in rcfile.c. */ #ifdef ENABLE_NANORC #ifdef ENABLE_COLOR -bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); void grab_and_store(const char *kind, char *ptr, regexlisttype **storage); #endif void parse_rcfile(FILE *rcstream, bool syntax_only); diff --git a/src/rcfile.c b/src/rcfile.c @@ -609,6 +609,34 @@ short color_to_short(const char *colorname, bool *bright) return -2; } +/* Parse the color name (or pair of color names) in the given string. + * Return FALSE when any color name is invalid; otherwise return TRUE. */ +bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright) +{ + char *comma = strchr(combostr, ','); + + if (comma != NULL) { + *bg = color_to_short(comma + 1, bright); + if (*bright) { + rcfile_error(N_("A background color cannot be bright")); + return FALSE; + } + if (*bg == -2) + return FALSE; + *comma = '\0'; + } else + *bg = -1; + + if (comma != combostr) { + *fg = color_to_short(combostr, bright); + if (*fg == -2) + return FALSE; + } else + *fg = -1; + + return TRUE; +} + /* Parse the color string in the line at ptr, and add it to the current * file's associated colors. rex_flags are the regex compilation flags * to use, excluding or including REG_ICASE for case (in)sensitivity. */ @@ -736,34 +764,6 @@ void parse_colors(char *ptr, int rex_flags) } } -/* Parse the color name (or pair of color names) in the given string. - * Return FALSE when any color name is invalid; otherwise return TRUE. */ -bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright) -{ - char *comma = strchr(combostr, ','); - - if (comma != NULL) { - *bg = color_to_short(comma + 1, bright); - if (*bright) { - rcfile_error(N_("A background color cannot be bright")); - return FALSE; - } - if (*bg == -2) - return FALSE; - *comma = '\0'; - } else - *bg = -1; - - if (comma != combostr) { - *fg = color_to_short(combostr, bright); - if (*fg == -2) - return FALSE; - } else - *fg = -1; - - return TRUE; -} - /* Parse the argument of an interface color option. */ colortype *parse_interface_color(char *combostr) {