help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OCTAVE_HISTFILE not honoured when file does exist


From: John W. Eaton
Subject: OCTAVE_HISTFILE not honoured when file does exist
Date: Mon, 6 Nov 2006 11:46:08 -0500

On  4-Nov-2006, Rafael Laboissiere wrote:

| I am trying to get Octave having separate history files in a per-directory
| basis.  I did:
| 
|     export OCTAVE_HISTFILE=./.octave_hist
| 
| However, this only works when the file .octave_hist already exists in the
| current directory.  If it does not, then Octave falls back to ~/.octave_hist
| but I would like to have Octave creating the history file for me if it does
| not exist.
| 
| Is the current behavior a bug or a feature?

I'm not sure.  Please try the attached patch.

jwe


src/ChangeLog:

2006-11-06  John W. Eaton  <address@hidden>

        * oct-hist.cc (default_history_file): If env_file is not empty,
        just accept it rather than checking to see if it exists.


Index: src/oct-hist.cc
===================================================================
RCS file: /cvs/octave/src/oct-hist.cc,v
retrieving revision 1.85
diff -u -u -r1.85 oct-hist.cc
--- src/oct-hist.cc     30 Jun 2006 18:19:21 -0000      1.85
+++ src/oct-hist.cc     6 Nov 2006 16:44:23 -0000
@@ -84,15 +84,7 @@
   std::string env_file = octave_env::getenv ("OCTAVE_HISTFILE");
 
   if (! env_file.empty ())
-    {
-      std::fstream f (env_file.c_str (), (std::ios::in | std::ios::out));
-
-      if (f)
-       {
-         file = env_file;
-         f.close ();
-       }
-    }
+    file = env_file;
 
   if (file.empty ())
     {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]