startup: don't ask the user to press Enter upon an rcfile error

The user told nano to start, thus nano should *start* -- without
halting and without nagging the user.
master
Benno Schulenberg 2017-10-07 16:03:22 +02:00
parent d054044d30
commit 953c2b8e79
1 changed files with 3 additions and 17 deletions

View File

@ -122,10 +122,8 @@ static const rcoption rcopts[] = {
{NULL, 0} {NULL, 0}
}; };
static bool errors = FALSE;
/* Whether we got any errors while parsing an rcfile. */
static size_t lineno = 0; static size_t lineno = 0;
/* If we did, the line number where the last error occurred. */ /* The line number of the last encountered error. */
static char *nanorc = NULL; static char *nanorc = NULL;
/* The path to the rcfile we're parsing. */ /* The path to the rcfile we're parsing. */
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
@ -138,9 +136,7 @@ static colortype *lastcolor = NULL;
/* The end of the color list for the current syntax. */ /* The end of the color list for the current syntax. */
#endif #endif
/* We have an error in some part of the rcfile. Print the error message /* Report an error in an rcfile, printing it to stderr. */
* on stderr, and then make the user hit Enter to continue starting
* nano. */
void rcfile_error(const char *msg, ...) void rcfile_error(const char *msg, ...)
{ {
va_list ap; va_list ap;
@ -148,11 +144,8 @@ void rcfile_error(const char *msg, ...)
if (ISSET(QUIET)) if (ISSET(QUIET))
return; return;
fprintf(stderr, "\n"); if (lineno > 0)
if (lineno > 0) {
errors = TRUE;
fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno); fprintf(stderr, _("Error in %s on line %lu: "), nanorc, (unsigned long)lineno);
}
va_start(ap, msg); va_start(ap, msg);
vfprintf(stderr, _(msg), ap); vfprintf(stderr, _(msg), ap);
@ -1248,13 +1241,6 @@ void do_rcfiles(void)
check_vitals_mapped(); check_vitals_mapped();
free(nanorc); free(nanorc);
if (errors && !ISSET(QUIET) && !ISSET(NO_PAUSES)) {
errors = FALSE;
fprintf(stderr, _("\nPress Enter to continue starting nano.\n"));
while (getchar() != '\n')
;
}
} }
#endif /* ENABLE_NANORC */ #endif /* ENABLE_NANORC */