2008-08-28 Chris Allegretta <chrisa@asty.org>

* configure.ac, rcfile.c:  Add support for an alternate rcfilename at configure time.  Maybe this
          should become a command line option some day, but I don't see the need currently.  Start of   
          fix for Savannah bug #24128: Add nanorc support to win32 platform.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2008-08-28 06:13:05 +00:00
parent dc7136a082
commit faeeb5bd7e
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-08-28 Chris Allegretta <chrisa@asty.org>
* configure.ac, rcfile.c: Add support for an alternate rcfilename at configure time. Maybe this
should become a command line option some day, but I don't see the need currently. Start of
fix for Savannah bug #24128: Add nanorc support to win32 platform.
2008-08-21 Chris Allegretta <chrisa@asty.org>
* text.c: Change error messages where we may possibly get into a bad state and urge
the user to save when this happens. Originally by Benno Schulenberg <bensberg@justemail.net>

View File

@ -387,6 +387,12 @@ fi
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
AC_ARG_ENABLE(altrcname,
[ --enable-altrcname Specify alternate rcfile name (default: .nanorc)],
[if test x$enableval != no; then
AC_DEFINE_UNQUOTED(RCFILE_NAME, "$enableval", [Specify alternate rcfile name (default: .nanorc)]) rcfilename=$enableval
fi])
dnl Checks for functions.
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)

View File

@ -1044,8 +1044,11 @@ void do_rcfile(void)
if (homedir == NULL)
rcfile_error(N_("I can't find my home directory! Wah!"));
else {
nanorc = charealloc(nanorc, strlen(homedir) + 9);
sprintf(nanorc, "%s/.nanorc", homedir);
#ifndef RCFILE_NAME
#define RCFILE_NAME ".nanorc"
#endif
nanorc = charealloc(nanorc, strlen(homedir) + strlen(RCFILE_NAME) + 2);
sprintf(nanorc, "%s/%s", homedir, RCFILE_NAME);
/* Don't open directories, character files, or block files. */
if (stat(nanorc, &rcinfo) != -1) {