(David Benbennick).
colortoint, parse_colors()
- Don't add strings with invalid fg colors at all.
+ do_rcfile()
+ - Revert (somewhat) previous behavior of looking at
+ $HOME, and only run getpw* if it is NULL. Most *nix programs
+ seem to only care about $HOME, and at the user-level
+ getpw* may not be reliable (and its slower).
- search.c:
do_gotoline()
- Only goto_abort() if we *didnt* abort the command, making
}
#endif
- /* Determine home directory using getpwent(), don't rely on $HOME */
- do {
- userage = getpwent();
- } while (userage != NULL && userage->pw_uid != euid);
- endpwent();
-
lineno = 0;
- if (userage == NULL) {
- rcfile_error(_("I can't find my home directory! Wah!"));
- SET(NO_RCFILE);
+ /* Rely on $HOME, fall back on getpwuid() */
+ if (getenv("HOME") != NULL) {
+ nanorc = nrealloc(nanorc, strlen(getenv("HOME")) + 10);
+ sprintf(nanorc, "%s/.nanorc", getenv("HOME"));
} else {
- nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
- sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
+ userage = getpwuid(euid);
+ endpwent();
+
+ if (userage == NULL) {
+ rcfile_error(_("I can't find my home directory! Wah!"));
+ SET(NO_RCFILE);
+ } else {
+ nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
+ sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
+
+ }
+ }
+
+ if (!ISSET(NO_RCFILE)) {
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
/* If we've already read $SYSCONFDIR/nanorc (if it's there), we're