Commit 8257bf14 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

2009-02-11 Chris Allegretta <chrisa@asty.org>

        * nanorc.c (parse_include): Do call real_dir_from_tilde() on included
          files in .nanorc, but still avoiding bug #25297.  Fixes ~ and ~user
          specifications for nanorc include files, as reported by Eitan Adler.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4375 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 12 additions and 5 deletions
+12 -5
2009-02-11 Chris Allegretta <chrisa@asty.org>
* nanorc.c (parse_include): Do call real_dir_from_tilde() on included
files in .nanorc, but still avoiding bug #25297. Fixes ~ and ~user
specifications for nanorc include files, as reported by Eitan Adler.
2009-02-09 Chris Allegretta <chrisa@asty.org> 2009-02-09 Chris Allegretta <chrisa@asty.org>
* New option -q, --quiet, rcfile option "quiet" implemented. Skips printing * New option -q, --quiet, rcfile option "quiet" implemented. Skips printing
errors about the rcfile and asking user to press enter. Also, nano should errors about the rcfile and asking user to press enter. Also, nano should
......
...@@ -474,7 +474,7 @@ void parse_include(char *ptr) ...@@ -474,7 +474,7 @@ void parse_include(char *ptr)
{ {
struct stat rcinfo; struct stat rcinfo;
FILE *rcstream; FILE *rcstream;
char *option, *nanorc_save = nanorc; char *option, *nanorc_save = nanorc, *expanded;
size_t lineno_save = lineno; size_t lineno_save = lineno;
option = ptr; option = ptr;
...@@ -495,20 +495,22 @@ void parse_include(char *ptr) ...@@ -495,20 +495,22 @@ void parse_include(char *ptr)
} }
} }
expanded = real_dir_from_tilde(option);
/* Open the new syntax file. */ /* Open the new syntax file. */
if ((rcstream = fopen(option, "rb")) == NULL) { if ((rcstream = fopen(expanded, "rb")) == NULL) {
rcfile_error(_("Error reading %s: %s"), option, rcfile_error(_("Error reading %s: %s"), expanded,
strerror(errno)); strerror(errno));
return; return;
} }
/* Use the name and line number position of the new syntax file /* Use the name and line number position of the new syntax file
* while parsing it, so we can know where any errors in it are. */ * while parsing it, so we can know where any errors in it are. */
nanorc = option; nanorc = expanded;
lineno = 0; lineno = 0;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Parsing file \"%s\"\n", option); fprintf(stderr, "Parsing file \"%s\" (expanded from \"%s\")\n", expanded, option);
#endif #endif
parse_rcfile(rcstream parse_rcfile(rcstream
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment