changeset 8273:2c1ba965b486

skip reading history file with --no-history option
author John W. Eaton <jwe@octave.org>
date Thu, 23 Oct 2008 16:01:06 -0400
parents ed5811a1ec8f
children 967c15c5e265
files src/ChangeLog src/oct-hist.cc src/oct-hist.h src/octave.cc
diffstat 4 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Oct 23 15:22:51 2008 -0400
+++ b/src/ChangeLog	Thu Oct 23 16:01:06 2008 -0400
@@ -1,5 +1,11 @@
 2008-10-23  John W. Eaton  <jwe@octave.org>
 
+	* oct-hist.c (initialize_history): New arg, read_history_file)
+	* oct-hist.h: Fix decl.
+	* octave.cc (octave_main): Set read_history_file to false if
+	--no-history option is specified.  Pass read_history_file to
+	initialize_history.
+
 	* DLD-FUNCTIONS/fltk_backend.cc: Update initialization comment.
 
 2008-10-22  John W. Eaton  <jwe@octave.org>
--- a/src/oct-hist.cc	Thu Oct 23 15:22:51 2008 -0400
+++ b/src/oct-hist.cc	Thu Oct 23 16:01:06 2008 -0400
@@ -529,12 +529,13 @@
 }
 
 void
-initialize_history (void)
+initialize_history (bool read_history_file)
 {
   command_history::set_file (Vhistory_file);
   command_history::set_size (Vhistory_size);
 
-  command_history::read (false);
+  if (read_history_file)
+    command_history::read (false);
 }
 
 void
--- a/src/oct-hist.h	Thu Oct 23 15:22:51 2008 -0400
+++ b/src/oct-hist.h	Thu Oct 23 16:01:06 2008 -0400
@@ -28,7 +28,7 @@
 
 #include "cmd-hist.h"
 
-extern void initialize_history (void);
+extern void initialize_history (bool read_history_file = false);
 
 // Write timestamp to history file.
 extern void octave_history_write_timestamp (void);
--- a/src/octave.cc	Thu Oct 23 15:22:51 2008 -0400
+++ b/src/octave.cc	Thu Oct 23 16:01:06 2008 -0400
@@ -628,12 +628,15 @@
 
   bool forced_line_editing = false;
 
+  bool read_history_file = true;
+
   int optc;
   while ((optc = args.getopt ()) != EOF)
     {
       switch (optc)
 	{
 	case 'H':
+	  read_history_file = false;
 	  bind_internal_variable ("saving_history", false);
 	  break;
 
@@ -776,7 +779,7 @@
 
   execute_startup_files ();
 
-  initialize_history ();
+  initialize_history (read_history_file);
 
   if (! inhibit_startup_message && reading_startup_message_printed)
     std::cout << std::endl;