diff --git a/src/proto.h b/src/proto.h index cda49650e1d210534da9623f82487a87ece23e68..00d37ccc590354738f925e1b7a90740a0ab0ebe6 100644 --- 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 index 2b81cb0ca32c45b4403a15dd5abe9925a5c907ad..6193dfcb5133c5d0686a72070a00e8d38bafff11 100644 --- 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) {