Ken's search history patch, minus the .nano_history stuff
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1334 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/rcfile.c b/rcfile.c
index 2499408..234bb1c 100644
--- a/rcfile.c
+++ b/rcfile.c
@@ -607,9 +607,10 @@
lineno = 0;
- if (userage == NULL)
+ if (userage == NULL) {
rcfile_error(_("I can't find my home directory! Wah!"));
- else {
+ SET(NO_RCFILE); /* if no .nanorc, don't try to read .nano_history */
+ } else {
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
@@ -621,9 +622,11 @@
#endif
if ((rcstream = fopen(nanorc, "r")) == NULL) {
/* Don't complain about the file not existing */
- if (errno != ENOENT)
+ if (errno != ENOENT) {
rcfile_error(_("Unable to open ~/.nanorc file, %s"),
strerror(errno));
+ SET(NO_RCFILE);
+ }
} else {
parse_rcfile(rcstream);
fclose(rcstream);