diff --git a/ChangeLog b/ChangeLog index e56c174070d9dd6a16057c0170c648d40326e8ec..1c2cb77acdc7884225b43a4d4a4627a3b8618236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,8 @@ CVS code - parse_next_regex() - Allow " symbol to be in regex without leading \ by checking for *ptr+1 is not the end of the regex. + do_rcfile() + - Parse rcfile in $SYSCONFDIR as well (Dwayne Rightler). - nano.c: help_init() - Added message re: having multiple blank buffers (DLR). diff --git a/rcfile.c b/rcfile.c index 6455fe009d2bdacfd73687160b2c63abb817f21e..3fa012d872f8be29f14e98930e590f82da47f187 100644 --- a/rcfile.c +++ b/rcfile.c @@ -432,12 +432,24 @@ void do_rcfile(void) { char *unable = _("Unable to open ~/.nanorc file, %s"); struct stat fileinfo; + int skip=0; FILE *rcstream; - if (getenv("HOME") == NULL) return; + nanorc = charalloc(strlen(SYSCONFDIR) + 10); + sprintf(nanorc, "%s/nanorc", SYSCONFDIR); + + /* Try to open system nanorc */ + if (stat(nanorc, &fileinfo) != -1) + if ((rcstream = fopen(nanorc, "r")) != NULL) { + + /* Parse it! */ + parse_rcfile(rcstream); + fclose(rcstream); + } + nanorc = charalloc(strlen(getenv("HOME")) + 10); sprintf(nanorc, "%s/.nanorc", getenv("HOME"));