[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LOADPATH problem
From: |
John Eaton |
Subject: |
Re: LOADPATH problem |
Date: |
Fri, 17 Feb 95 09:47:54 CST |
Eyal Doron <address@hidden> wrote:
: I wonder if anybody can solve this. I've got Octave working on an
: Alpha OSF/1 3.0. However. if I specify e.g. the line
: LOADPATH="~/mat:";
: on my .octaverc file, I seem to lose the path to the Octave .m files,
: in spite of the trailing colon. A leading colon gives the same result.
: Any ideas?
It's a bug. Here's a patch that should fix it:
Fri Feb 17 08:12:09 1995 John Eaton <address@hidden>
* src/variables.cc (maybe_add_default_load_path): New function,
extracted from default_path(), which no longer needs it.
* src/user-prefs.cc (sv_loadpath): Call it here.
*** src/variables.h~ 1995/02/03 21:57:34
--- src/variables.h 1995/02/17 14:47:57
***************
*** 114,119 ****
--- 114,121 ----
extern void install_builtin_variables (void);
+ extern char *maybe_add_default_load_path (const char *p);
+
extern char *octave_lib_dir (void);
extern char *octave_arch_lib_dir (void);
extern char *octave_bin_dir (void);
*** src/variables.cc~ 1995/02/15 21:16:26
--- src/variables.cc 1995/02/17 15:31:07
***************
*** 378,383 ****
--- 378,410 ----
return pager_binary;
}
+ // Always returns a new string.
+
+ char *
+ maybe_add_default_load_path (const char *p)
+ {
+ static char *std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
+
+ char *pathstring = strsave (p);
+
+ if (pathstring[0] == SEPCHAR)
+ {
+ char *tmp = pathstring;
+ pathstring = strconcat (std_path, pathstring);
+ delete [] tmp;
+ }
+
+ int tmp_len = strlen (pathstring);
+ if (pathstring[tmp_len-1] == SEPCHAR)
+ {
+ char *tmp = pathstring;
+ pathstring = strconcat (pathstring, std_path);
+ delete [] tmp;
+ }
+
+ return pathstring;
+ }
+
char *
octave_lib_dir (void)
{
***************
*** 396,431 ****
char *
default_path (void)
{
- static char *pathstring = 0;
- delete [] pathstring;
-
static char *std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
! char *oct_path = getenv ("OCTAVE_PATH");
! if (oct_path)
! {
! pathstring = strsave (oct_path);
!
! if (pathstring[0] == SEPCHAR)
! {
! char *tmp = pathstring;
! pathstring = strconcat (std_path, pathstring);
! delete [] tmp;
! }
!
! int tmp_len = strlen (pathstring);
! if (pathstring[tmp_len-1] == SEPCHAR)
! {
! char *tmp = pathstring;
! pathstring = strconcat (pathstring, std_path);
! delete [] tmp;
! }
! }
! else
! pathstring = strsave (std_path);
! return pathstring;
}
char *
--- 423,436 ----
char *
default_path (void)
{
static char *std_path = subst_octave_home (OCTAVE_FCNFILEPATH);
! static char *oct_path = getenv ("OCTAVE_PATH");
! static char *pathstring = 0;
! delete [] pathstring;
! return oct_path ? strsave (oct_path) : strsave (std_path);
}
char *
*** src/user-prefs.cc~ 1995/02/15 21:19:47
--- src/user-prefs.cc 1995/02/17 14:47:38
***************
*** 704,710 ****
if (s)
{
delete [] user_pref.loadpath;
! user_pref.loadpath = s;
}
else
{
--- 704,710 ----
if (s)
{
delete [] user_pref.loadpath;
! user_pref.loadpath = maybe_add_default_load_path (s);
}
else
{
Thanks,
jwe