Tweaking some comments and reshuffling/reindenting some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5719 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
fb7f7011ec
commit
b8aae4d872
|
@ -1,6 +1,7 @@
|
||||||
2016-03-11 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-11 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/browser.c (do_browser): Fix compilation when configured with
|
* src/browser.c (do_browser): Fix compilation when configured with
|
||||||
--enable-tiny plus --enable-browser.
|
--enable-tiny plus --enable-browser.
|
||||||
|
* src/rcfile.c: Tweak some comments and reshuffle some lines.
|
||||||
|
|
||||||
2016-03-10 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-10 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'
|
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'
|
||||||
|
|
40
src/rcfile.c
40
src/rcfile.c
|
@ -213,15 +213,16 @@ char *parse_argument(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
/* Parse the next regex string from the line at ptr, and return it. */
|
/* Pass over the current regex string in the line starting at ptr,
|
||||||
|
* null-terminate it, and return a pointer to the /next/ word. */
|
||||||
char *parse_next_regex(char *ptr)
|
char *parse_next_regex(char *ptr)
|
||||||
{
|
{
|
||||||
assert(ptr != NULL);
|
assert(ptr != NULL);
|
||||||
|
|
||||||
/* Continue until the end of the line, or a " followed by a space, a
|
/* Continue until the end of line, or until a " followed by a
|
||||||
* blank character, or \0. */
|
* blank character or the end of line. */
|
||||||
while ((*ptr != '"' || (!isblank(*(ptr + 1)) &&
|
while (*ptr != '\0' && (*ptr != '"' ||
|
||||||
*(ptr + 1) != '\0')) && *ptr != '\0')
|
(*(ptr + 1) != '\0' && !isblank(*(ptr + 1)))))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
assert(*ptr == '"' || *ptr == '\0');
|
assert(*ptr == '"' || *ptr == '\0');
|
||||||
|
@ -242,7 +243,7 @@ char *parse_next_regex(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compile the regular expression regex to see if it's valid. Return
|
/* Compile the regular expression regex to see if it's valid. Return
|
||||||
* TRUE if it is, or FALSE otherwise. */
|
* TRUE if it is, and FALSE otherwise. */
|
||||||
bool nregcomp(const char *regex, int eflags)
|
bool nregcomp(const char *regex, int eflags)
|
||||||
{
|
{
|
||||||
regex_t preg;
|
regex_t preg;
|
||||||
|
@ -262,8 +263,8 @@ bool nregcomp(const char *regex, int eflags)
|
||||||
return (rc == 0);
|
return (rc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the next syntax string from the line at ptr, and add it to the
|
/* Parse the next syntax name and its possible extension regexes from the
|
||||||
* global list of color syntaxes. */
|
* line at ptr, and add it to the global linked list of color syntaxes. */
|
||||||
void parse_syntax(char *ptr)
|
void parse_syntax(char *ptr)
|
||||||
{
|
{
|
||||||
char *nameptr;
|
char *nameptr;
|
||||||
|
@ -912,7 +913,7 @@ static void check_vitals_mapped(void)
|
||||||
|
|
||||||
/* Parse the rcfile, once it has been opened successfully at rcstream,
|
/* Parse the rcfile, once it has been opened successfully at rcstream,
|
||||||
* and close it afterwards. If syntax_only is TRUE, only allow the file
|
* and close it afterwards. If syntax_only is TRUE, only allow the file
|
||||||
* to contain color syntax commands: syntax, color, and icolor. */
|
* to contain color syntax commands. */
|
||||||
void parse_rcfile(FILE *rcstream
|
void parse_rcfile(FILE *rcstream
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
, bool syntax_only
|
, bool syntax_only
|
||||||
|
@ -963,21 +964,21 @@ void parse_rcfile(FILE *rcstream
|
||||||
syntaxname);
|
syntaxname);
|
||||||
opensyntax = FALSE;
|
opensyntax = FALSE;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
live_syntax = sint;
|
live_syntax = sint;
|
||||||
opensyntax = TRUE;
|
opensyntax = TRUE;
|
||||||
|
|
||||||
keyword = ptr;
|
keyword = ptr;
|
||||||
ptr = parse_next_word(ptr);
|
ptr = parse_next_word(ptr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Try to parse the keyword. */
|
/* Try to parse the keyword. */
|
||||||
if (strcasecmp(keyword, "set") == 0) {
|
if (strcasecmp(keyword, "set") == 0) {
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
if (syntax_only)
|
if (syntax_only)
|
||||||
rcfile_error(
|
rcfile_error(N_("Command \"%s\" not allowed in included file"),
|
||||||
N_("Command \"%s\" not allowed in included file"),
|
|
||||||
keyword);
|
keyword);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -985,8 +986,7 @@ void parse_rcfile(FILE *rcstream
|
||||||
} else if (strcasecmp(keyword, "unset") == 0) {
|
} else if (strcasecmp(keyword, "unset") == 0) {
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
if (syntax_only)
|
if (syntax_only)
|
||||||
rcfile_error(
|
rcfile_error(N_("Command \"%s\" not allowed in included file"),
|
||||||
N_("Command \"%s\" not allowed in included file"),
|
|
||||||
keyword);
|
keyword);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -995,8 +995,7 @@ void parse_rcfile(FILE *rcstream
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
else if (strcasecmp(keyword, "include") == 0) {
|
else if (strcasecmp(keyword, "include") == 0) {
|
||||||
if (syntax_only)
|
if (syntax_only)
|
||||||
rcfile_error(
|
rcfile_error(N_("Command \"%s\" not allowed in included file"),
|
||||||
N_("Command \"%s\" not allowed in included file"),
|
|
||||||
keyword);
|
keyword);
|
||||||
else
|
else
|
||||||
parse_include(ptr);
|
parse_include(ptr);
|
||||||
|
@ -1006,14 +1005,14 @@ void parse_rcfile(FILE *rcstream
|
||||||
live_syntax->name);
|
live_syntax->name);
|
||||||
parse_syntax(ptr);
|
parse_syntax(ptr);
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp(keyword, "header") == 0)
|
||||||
|
grab_and_store("header", ptr, &live_syntax->headers);
|
||||||
else if (strcasecmp(keyword, "magic") == 0)
|
else if (strcasecmp(keyword, "magic") == 0)
|
||||||
#ifdef HAVE_LIBMAGIC
|
#ifdef HAVE_LIBMAGIC
|
||||||
grab_and_store("magic", ptr, &live_syntax->magics);
|
grab_and_store("magic", ptr, &live_syntax->magics);
|
||||||
#else
|
#else
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
else if (strcasecmp(keyword, "header") == 0)
|
|
||||||
grab_and_store("header", ptr, &live_syntax->headers);
|
|
||||||
else if (strcasecmp(keyword, "color") == 0)
|
else if (strcasecmp(keyword, "color") == 0)
|
||||||
parse_colors(ptr, FALSE);
|
parse_colors(ptr, FALSE);
|
||||||
else if (strcasecmp(keyword, "icolor") == 0)
|
else if (strcasecmp(keyword, "icolor") == 0)
|
||||||
|
@ -1301,8 +1300,7 @@ void do_rcfile(void)
|
||||||
|
|
||||||
if (errors && !ISSET(QUIET)) {
|
if (errors && !ISSET(QUIET)) {
|
||||||
errors = FALSE;
|
errors = FALSE;
|
||||||
fprintf(stderr,
|
fprintf(stderr, _("\nPress Enter to continue starting nano.\n"));
|
||||||
_("\nPress Enter to continue starting nano.\n"));
|
|
||||||
while (getchar() != '\n')
|
while (getchar() != '\n')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue