changeset 15474:457a2ff2a71b

set Vinfo_file and Vinfo_program variables directly from command line options * octave.cc (octave_process_command_line): Set Vinfo_file and Vinfo_program directly. (octave_initialize_interpreter): Don't call bind_internal_variable to set Vinfo_file or Vinfo_program. * defaults.cc (set_default_info_file): Don't set Vinfo_file unless it is empty. (set_default_info_prog): Don't set Vinfo_program unless it is empty.
author John W. Eaton <jwe@octave.org>
date Wed, 03 Oct 2012 02:17:28 -0400
parents c8c828276b69
children 1865feebb415
files libinterp/interpfcn/defaults.cc libinterp/octave.cc
diffstat 2 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/defaults.cc
+++ b/libinterp/interpfcn/defaults.cc
@@ -316,22 +316,28 @@
 static void
 set_default_info_file (void)
 {
-  std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE);
+  if (Vinfo_file.empty ())
+    {
+      std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE);
 
-  std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE");
+      std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE");
 
-  Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file;
+      Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file;
+    }
 }
 
 static void
 set_default_info_prog (void)
 {
-  std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
+  if (Vinfo_program.empty ())
+    {
+      std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
 
-  if (oct_info_prog.empty ())
-    Vinfo_program = "info";
-  else
-    Vinfo_program = std::string (oct_info_prog);
+      if (oct_info_prog.empty ())
+        Vinfo_program = "info";
+      else
+        Vinfo_program = std::string (oct_info_prog);
+    }
 }
 
 static void
--- a/libinterp/octave.cc
+++ b/libinterp/octave.cc
@@ -52,6 +52,7 @@
 #include "display.h"
 #include "error.h"
 #include "file-io.h"
+#include "help.h"
 #include "input.h"
 #include "lex.h"
 #include "load-path.h"
@@ -815,12 +816,12 @@
 
         case INFO_FILE_OPTION:
           if (optarg)
-            info_file = optarg;
+            Vinfo_file = optarg;
           break;
 
         case INFO_PROG_OPTION:
           if (optarg)
-            info_program = optarg;
+            Vinfo_program = optarg;
           break;
 
         case JIT_DEBUG_OPTION:
@@ -962,12 +963,6 @@
   if (! image_path.empty ())
     set_image_path (image_path);
 
-  if (! info_file.empty ())
-    bind_internal_variable ("info_file", info_file);
-
-  if (! info_program.empty ())
-    bind_internal_variable ("info_program", info_program);
-
   if (no_window_system)
     display_info::no_window_system ();