- proto.h:
- Missing externs (Rocco).
- rcfile.c:
+ do_rcfile()
+ - Reset lineno between system and local .nanorc file.
+ - Fix errno->strerror(errno) mismatch.
parse_rcfile()
- Don't use i for both for loop and atoi(), fixes lots of
potential crashes, 1st reported by Jean-Philippe Guérard.
+ rcfile_error()
+ - Don't print out the file name if we haven't opened the file
+ yet (lineno == 0).
- search.c:
search_init()
- Fix a missing free (Rocco).
va_list ap;
fprintf(stderr, "\n");
- fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
+ if (lineno > 0)
+ fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);
+
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
nanorc = charalloc(strlen(getenv("HOME")) + 10);
sprintf(nanorc, "%s/.nanorc", getenv("HOME"));
+ lineno = 0;
if (stat(nanorc, &fileinfo) == -1) {
/* Abort if the file doesn't exist and there's some other kind
of error stat()ing it */
if (errno != ENOENT)
- rcfile_error(unable, errno);
+ rcfile_error(unable, strerror(errno));
return;
}