Tweaking some comments and reshuffling/reindenting some lines.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5719 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2016-03-11 16:39:27 +00:00
parent fb7f7011ec
commit b8aae4d872
2 changed files with 28 additions and 29 deletions

View File

@ -1,6 +1,7 @@
2016-03-11 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser): Fix compilation when configured with
--enable-tiny plus --enable-browser.
* src/rcfile.c: Tweak some comments and reshuffle some lines.
2016-03-10 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'

View File

@ -213,15 +213,16 @@ char *parse_argument(char *ptr)
}
#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)
{
assert(ptr != NULL);
/* Continue until the end of the line, or a " followed by a space, a
* blank character, or \0. */
while ((*ptr != '"' || (!isblank(*(ptr + 1)) &&
*(ptr + 1) != '\0')) && *ptr != '\0')
/* Continue until the end of line, or until a " followed by a
* blank character or the end of line. */
while (*ptr != '\0' && (*ptr != '"' ||
(*(ptr + 1) != '\0' && !isblank(*(ptr + 1)))))
ptr++;
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
* TRUE if it is, or FALSE otherwise. */
* TRUE if it is, and FALSE otherwise. */
bool nregcomp(const char *regex, int eflags)
{
regex_t preg;
@ -262,8 +263,8 @@ bool nregcomp(const char *regex, int eflags)
return (rc == 0);
}
/* Parse the next syntax string from the line at ptr, and add it to the
* global list of color syntaxes. */
/* Parse the next syntax name and its possible extension regexes from the
* line at ptr, and add it to the global linked list of color syntaxes. */
void parse_syntax(char *ptr)
{
char *nameptr;
@ -912,7 +913,7 @@ static void check_vitals_mapped(void)
/* Parse the rcfile, once it has been opened successfully at rcstream,
* 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
#ifndef DISABLE_COLOR
, bool syntax_only
@ -963,21 +964,21 @@ void parse_rcfile(FILE *rcstream
syntaxname);
opensyntax = FALSE;
continue;
} else {
}
live_syntax = sint;
opensyntax = TRUE;
keyword = ptr;
ptr = parse_next_word(ptr);
}
}
#endif
/* Try to parse the keyword. */
if (strcasecmp(keyword, "set") == 0) {
#ifndef DISABLE_COLOR
if (syntax_only)
rcfile_error(
N_("Command \"%s\" not allowed in included file"),
rcfile_error(N_("Command \"%s\" not allowed in included file"),
keyword);
else
#endif
@ -985,8 +986,7 @@ void parse_rcfile(FILE *rcstream
} else if (strcasecmp(keyword, "unset") == 0) {
#ifndef DISABLE_COLOR
if (syntax_only)
rcfile_error(
N_("Command \"%s\" not allowed in included file"),
rcfile_error(N_("Command \"%s\" not allowed in included file"),
keyword);
else
#endif
@ -995,8 +995,7 @@ void parse_rcfile(FILE *rcstream
#ifndef DISABLE_COLOR
else if (strcasecmp(keyword, "include") == 0) {
if (syntax_only)
rcfile_error(
N_("Command \"%s\" not allowed in included file"),
rcfile_error(N_("Command \"%s\" not allowed in included file"),
keyword);
else
parse_include(ptr);
@ -1006,14 +1005,14 @@ void parse_rcfile(FILE *rcstream
live_syntax->name);
parse_syntax(ptr);
}
else if (strcasecmp(keyword, "header") == 0)
grab_and_store("header", ptr, &live_syntax->headers);
else if (strcasecmp(keyword, "magic") == 0)
#ifdef HAVE_LIBMAGIC
grab_and_store("magic", ptr, &live_syntax->magics);
#else
;
#endif
else if (strcasecmp(keyword, "header") == 0)
grab_and_store("header", ptr, &live_syntax->headers);
else if (strcasecmp(keyword, "color") == 0)
parse_colors(ptr, FALSE);
else if (strcasecmp(keyword, "icolor") == 0)
@ -1301,8 +1300,7 @@ void do_rcfile(void)
if (errors && !ISSET(QUIET)) {
errors = FALSE;
fprintf(stderr,
_("\nPress Enter to continue starting nano.\n"));
fprintf(stderr, _("\nPress Enter to continue starting nano.\n"));
while (getchar() != '\n')
;
}