2016-03-12 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (color_update): Set the syntax and regex pointers
just once, in a single place. And unnest two 'if's.
+ * src/rcfile.c (parse_one_include, parse_includes): New names for
+ these functions, to be more distinguishable.
2016-03-11 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser): Fix compilation when configured with
char *parse_next_regex(char *ptr);
bool nregcomp(const char *regex, int eflags);
void parse_syntax(char *ptr);
-void parse_include(char *ptr);
+void parse_includes(char *ptr);
short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase);
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
free(keycopy);
}
-
#ifndef DISABLE_COLOR
-/* Read and parse additional syntax files. */
-static void _parse_include(char *file)
+/* Read and parse one included syntax file. */
+static void parse_one_include(char *file)
{
struct stat rcinfo;
FILE *rcstream;
parse_rcfile(rcstream, TRUE);
}
-void parse_include(char *ptr)
+/* Expand globs in the passed name, and parse the resultant files. */
+void parse_includes(char *ptr)
{
char *option, *nanorc_save = nanorc, *expanded;
size_t lineno_save = lineno, i;
if (glob(expanded, GLOB_ERR|GLOB_NOSORT, NULL, &files) == 0) {
for (i = 0; i < files.gl_pathc; ++i)
- _parse_include(files.gl_pathv[i]);
- } else {
+ parse_one_include(files.gl_pathv[i]);
+ } else
rcfile_error(_("Error expanding %s: %s"), option,
strerror(errno));
- }
globfree(&files);
free(expanded);
- /* We're done with the new syntax file. Restore the original
+ /* We're done with the included file(s). Restore the original
* filename and line number position. */
nanorc = nanorc_save;
lineno = lineno_save;
rcfile_error(N_("Command \"%s\" not allowed in included file"),
keyword);
else
- parse_include(ptr);
+ parse_includes(ptr);
} else if (strcasecmp(keyword, "syntax") == 0) {
if (opensyntax && endcolor == NULL)
rcfile_error(N_("Syntax \"%s\" has no color commands"),