formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2365 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
9389ca29cf
commit
08c70ae1e9
74
src/rcfile.c
74
src/rcfile.c
|
@ -242,7 +242,8 @@ char *parse_next_regex(char *ptr)
|
||||||
assert(*ptr == '"' || *ptr == '\0');
|
assert(*ptr == '"' || *ptr == '\0');
|
||||||
|
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +288,8 @@ void parse_syntax(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,10 +374,11 @@ void parse_colors(char *ptr)
|
||||||
strtok(fgstr, ",");
|
strtok(fgstr, ",");
|
||||||
bgcolorname = strtok(NULL, ",");
|
bgcolorname = strtok(NULL, ",");
|
||||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||||
rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
|
rcfile_error(
|
||||||
|
N_("Background color %s cannot be bright"),
|
||||||
|
bgcolorname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bg = color_to_int(bgcolorname, &bright);
|
bg = color_to_int(bgcolorname, &bright);
|
||||||
} else
|
} else
|
||||||
bg = -1;
|
bg = -1;
|
||||||
|
@ -387,7 +390,8 @@ void parse_colors(char *ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (syntaxes == NULL) {
|
if (syntaxes == NULL) {
|
||||||
rcfile_error(N_("Cannot add a color directive without a syntax line"));
|
rcfile_error(
|
||||||
|
N_("Cannot add a color directive without a syntax line"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +412,8 @@ void parse_colors(char *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character"));
|
||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -447,12 +452,14 @@ void parse_colors(char *ptr)
|
||||||
|
|
||||||
if (expectend) {
|
if (expectend) {
|
||||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
||||||
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
|
rcfile_error(
|
||||||
|
N_("\"start=\" requires a corresponding \"end=\""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
if (*ptr != '"') {
|
if (*ptr != '"') {
|
||||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
rcfile_error(
|
||||||
|
N_("Regex strings must begin and end with a \" character"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +552,9 @@ void parse_rcfile(FILE *rcstream)
|
||||||
/* This option doesn't have a flag, so it takes
|
/* This option doesn't have a flag, so it takes
|
||||||
* an argument. */
|
* an argument. */
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
|
rcfile_error(
|
||||||
|
N_("Option %s requires an argument"),
|
||||||
|
rcopts[i].name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
option = ptr;
|
option = ptr;
|
||||||
|
@ -563,7 +572,9 @@ void parse_rcfile(FILE *rcstream)
|
||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||||
if (!parse_num(option, &wrap_at)) {
|
if (!parse_num(option, &wrap_at)) {
|
||||||
rcfile_error(N_("Requested fill size %s invalid"), option);
|
rcfile_error(
|
||||||
|
N_("Requested fill size %s invalid"),
|
||||||
|
option);
|
||||||
wrap_at = -CHARS_FROM_EOL;
|
wrap_at = -CHARS_FROM_EOL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -572,7 +583,8 @@ void parse_rcfile(FILE *rcstream)
|
||||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||||
whitespace = make_mbstring(option, whitespace);
|
whitespace = make_mbstring(option, whitespace);
|
||||||
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
if (mbstrlen(whitespace) != 2 || strlenpt(whitespace) != 2) {
|
||||||
rcfile_error(N_("Two single-column characters required"));
|
rcfile_error(
|
||||||
|
N_("Two single-column characters required"));
|
||||||
free(whitespace);
|
free(whitespace);
|
||||||
whitespace = NULL;
|
whitespace = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -589,24 +601,31 @@ void parse_rcfile(FILE *rcstream)
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||||
punct = mallocstrcpy(NULL, option);
|
punct = mallocstrcpy(NULL, option);
|
||||||
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
if (strchr(punct, '\t') != NULL ||
|
||||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
strchr(punct, ' ') != NULL) {
|
||||||
|
rcfile_error(
|
||||||
|
N_("Non-tab and non-space characters required"));
|
||||||
free(punct);
|
free(punct);
|
||||||
punct = NULL;
|
punct = NULL;
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
|
} else if (strcasecmp(rcopts[i].name,
|
||||||
|
"brackets") == 0) {
|
||||||
brackets = mallocstrcpy(NULL, option);
|
brackets = mallocstrcpy(NULL, option);
|
||||||
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
if (strchr(brackets, '\t') != NULL ||
|
||||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
strchr(brackets, ' ') != NULL) {
|
||||||
|
rcfile_error(
|
||||||
|
N_("Non-tab and non-space characters required"));
|
||||||
free(brackets);
|
free(brackets);
|
||||||
brackets = NULL;
|
brackets = NULL;
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(rcopts[i].name, "quotestr") == 0)
|
} else if (strcasecmp(rcopts[i].name,
|
||||||
|
"quotestr") == 0)
|
||||||
quotestr = mallocstrcpy(NULL, option);
|
quotestr = mallocstrcpy(NULL, option);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (strcasecmp(rcopts[i].name, "backupdir") == 0)
|
if (strcasecmp(rcopts[i].name,
|
||||||
|
"backupdir") == 0)
|
||||||
backup_dir = mallocstrcpy(NULL, option);
|
backup_dir = mallocstrcpy(NULL, option);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -615,9 +634,13 @@ void parse_rcfile(FILE *rcstream)
|
||||||
alt_speller = mallocstrcpy(NULL, option);
|
alt_speller = mallocstrcpy(NULL, option);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
|
if (strcasecmp(rcopts[i].name,
|
||||||
if (!parse_num(option, &tabsize) || tabsize <= 0) {
|
"tabsize") == 0) {
|
||||||
rcfile_error(N_("Requested tab size %s invalid"), option);
|
if (!parse_num(option, &tabsize) ||
|
||||||
|
tabsize <= 0) {
|
||||||
|
rcfile_error(
|
||||||
|
N_("Requested tab size %s invalid"),
|
||||||
|
option);
|
||||||
tabsize = -1;
|
tabsize = -1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -629,7 +652,8 @@ void parse_rcfile(FILE *rcstream)
|
||||||
} else if (rcopts[i].flag != 0)
|
} else if (rcopts[i].flag != 0)
|
||||||
UNSET(rcopts[i].flag);
|
UNSET(rcopts[i].flag);
|
||||||
else
|
else
|
||||||
rcfile_error(N_("Cannot unset flag %s"), rcopts[i].name);
|
rcfile_error(N_("Cannot unset flag %s"),
|
||||||
|
rcopts[i].name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,7 +667,8 @@ void parse_rcfile(FILE *rcstream)
|
||||||
|
|
||||||
if (errors) {
|
if (errors) {
|
||||||
errors = FALSE;
|
errors = FALSE;
|
||||||
fprintf(stderr, _("\nPress Return to continue starting nano\n"));
|
fprintf(stderr,
|
||||||
|
_("\nPress Return to continue starting nano\n"));
|
||||||
while (getchar() != '\n')
|
while (getchar() != '\n')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +711,8 @@ void do_rcfile(void)
|
||||||
if (rcstream == NULL) {
|
if (rcstream == NULL) {
|
||||||
/* Don't complain about the file's not existing. */
|
/* Don't complain about the file's not existing. */
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
|
rcfile_error(N_("Error reading %s: %s"), nanorc,
|
||||||
|
strerror(errno));
|
||||||
} else
|
} else
|
||||||
parse_rcfile(rcstream);
|
parse_rcfile(rcstream);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue