changeset 11294:e2a4f3478b7c

datetick.m: add missing semicolon
author John W. Eaton <jwe@octave.org>
date Thu, 25 Nov 2010 02:18:58 -0500
parents 202bd0f1863d
children 75ff3db6a687
files scripts/ChangeLog scripts/time/datetick.m src/defaults.cc
diffstat 3 files changed, 38 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Nov 23 03:11:32 2010 -0500
+++ b/scripts/ChangeLog	Thu Nov 25 02:18:58 2010 -0500
@@ -1,3 +1,7 @@
+2010-11-25  John W. Eaton  <jwe@octave.org>
+
+	* time/datetick.m: Add missing semicolon.
+
 2010-11-21  Rik  <octave@nomad.inbox5.com>
 
 	* optimization/sqp.m: Use correct stopping tolerance in documentation.
--- a/scripts/time/datetick.m	Tue Nov 23 03:11:32 2010 -0500
+++ b/scripts/time/datetick.m	Thu Nov 25 02:18:58 2010 -0500
@@ -125,7 +125,7 @@
   endif
 
   if (keepticks)
-    ticks = get (gca (), strcat (ax, "tick"))
+    ticks = get (gca (), strcat (ax, "tick"));
   else
     ## Need to do our own axis tick position calculation as
     ## year, etc, don't fallback on nice datenum values.
--- a/src/defaults.cc	Tue Nov 23 03:11:32 2010 -0500
+++ b/src/defaults.cc	Thu Nov 25 02:18:58 2010 -0500
@@ -227,31 +227,42 @@
 }
 
 void
-set_exec_path (const std::string& path)
+set_exec_path (const std::string& path_arg)
 {
-  VEXEC_PATH = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str ()
-    + Vlocal_api_arch_lib_dir + dir_path::path_sep_str ()
-    + Vlocal_arch_lib_dir + dir_path::path_sep_str ()
-    + Varch_lib_dir + dir_path::path_sep_str ()
-    + Vbin_dir;
-  
+  std::string tpath = path_arg;
+
+  if (tpath.empty ())
+    tpath = octave_env::getenv ("OCTAVE_EXEC_PATH");
+
+  if (tpath.empty ())
+    tpath = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str ()
+      + Vlocal_api_arch_lib_dir + dir_path::path_sep_str ()
+      + Vlocal_arch_lib_dir + dir_path::path_sep_str ()
+      + Varch_lib_dir + dir_path::path_sep_str ()
+      + Vbin_dir;
+
+  VEXEC_PATH = tpath;
+
+  // FIXME -- should we really be modifying PATH in the environment?
+  // The way things are now, Octave will ignore directories set in the
+  // PATH with calls like
+  //
+  //   setenv ("PATH", "/my/path");
+  //
+  // To fix this, I think Octave should be searching the combination of
+  // PATH and EXEC_PATH for programs that it executes instead of setting
+  // the PATH in the environment and relying on the shell to do the
+  // searching.
+
   // This is static so that even if set_exec_path is called more than
   // once, shell_path is the original PATH from the environment,
   // before we start modifying it.
   static std::string shell_path = octave_env::getenv ("PATH");
 
   if (! shell_path.empty ())
-    VEXEC_PATH += dir_path::path_sep_str () + shell_path;
-
-  std::string tpath = path;
+    tpath = shell_path + dir_path::path_sep_str () + tpath;
 
-  if (tpath.empty ())
-    tpath = octave_env::getenv ("OCTAVE_EXEC_PATH");
-
-  if (! tpath.empty ())
-    VEXEC_PATH = tpath + dir_path::path_sep_str () + VEXEC_PATH;
-
-  octave_env::putenv ("PATH", VEXEC_PATH);
+  octave_env::putenv ("PATH", tpath);
 }
 
 void
@@ -414,23 +425,15 @@
 @deftypefn  {Built-in Function} {@var{val} =} EXEC_PATH ()\n\
 @deftypefnx {Built-in Function} {@var{old_val} =} EXEC_PATH (@var{new_val})\n\
 Query or set the internal variable that specifies a colon separated\n\
-list of directories to search when executing external programs.\n\
-Its initial value is taken from the environment variable\n\
-@w{@env{OCTAVE_EXEC_PATH}} (if it exists) or @env{PATH}, but that\n\
-value can be overridden by the command line argument\n\
-@option{--exec-path PATH}.  At startup, an additional set of\n\
-directories (including the shell PATH) is appended to the path\n\
-specified in the environment or on the command line.  If you use\n\
-the @w{@env{EXEC_PATH}} function to modify the path, you should take\n\
-care to preserve these additional directories.\n\
+list of directories to append to the shell PATH when executing external\n\
+programs.  The initial value of is taken from the environment variable\n\
+@w{@env{OCTAVE_EXEC_PATH}}, but that value can be overridden by\n\
+the command line argument @option{--exec-path PATH}.\n\
 @end deftypefn")
 {
-  std::string saved_exec_path = VEXEC_PATH;
-
   octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH);
 
-  if (VEXEC_PATH != saved_exec_path)
-    octave_env::putenv ("PATH", VEXEC_PATH);
+  set_exec_path (VEXEC_PATH);
 
   return retval;
 }