Mercurial > hg > octave-lyh
annotate src/defaults.cc @ 11298:cb94bdc74670
defaults.cc (FEXEC_PATH): only call set_exec_path if nargin is greater than zero
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 26 Nov 2010 02:44:24 -0500 |
parents | e2a4f3478b7c |
children | fd0a3ac60b0e |
rev | line source |
---|---|
2203 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 2006, 2007, 2008, 2009 John W. Eaton |
2203 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2203 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2203 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include <cstdlib> | |
29 | |
6114 | 30 #include <algorithm> |
3503 | 31 #include <iostream> |
2203 | 32 #include <string> |
33 | |
34 #include <sys/types.h> | |
35 #include <unistd.h> | |
36 | |
5814 | 37 #include "dir-ops.h" |
2926 | 38 #include "oct-env.h" |
4217 | 39 #include "file-stat.h" |
3174 | 40 #include "pathsearch.h" |
4217 | 41 #include "str-vec.h" |
2926 | 42 |
2492 | 43 #include <defaults.h> |
2203 | 44 #include "defun.h" |
45 #include "error.h" | |
3040 | 46 #include "file-ops.h" |
2203 | 47 #include "gripes.h" |
48 #include "help.h" | |
5395 | 49 #include "input.h" |
5832 | 50 #include "load-path.h" |
3185 | 51 #include "oct-obj.h" |
2390 | 52 #include "ov.h" |
4217 | 53 #include "parse.h" |
2203 | 54 #include "toplev.h" |
4217 | 55 #include "unwind-prot.h" |
2203 | 56 #include "variables.h" |
2492 | 57 #include <version.h> |
2203 | 58 |
3523 | 59 std::string Voctave_home; |
2203 | 60 |
3523 | 61 std::string Vbin_dir; |
62 std::string Vinfo_dir; | |
63 std::string Vdata_dir; | |
64 std::string Vlibexec_dir; | |
65 std::string Varch_lib_dir; | |
66 std::string Vlocal_arch_lib_dir; | |
5909 | 67 std::string Vlocal_api_arch_lib_dir; |
3597 | 68 std::string Vlocal_ver_arch_lib_dir; |
5814 | 69 |
70 std::string Vlocal_ver_oct_file_dir; | |
71 std::string Vlocal_api_oct_file_dir; | |
72 std::string Vlocal_oct_file_dir; | |
2203 | 73 |
5814 | 74 std::string Vlocal_ver_fcn_file_dir; |
75 std::string Vlocal_api_fcn_file_dir; | |
76 std::string Vlocal_fcn_file_dir; | |
77 | |
78 std::string Voct_file_dir; | |
79 std::string Vfcn_file_dir; | |
80 | |
81 std::string Vimage_dir; | |
4447 | 82 |
2203 | 83 // The path that will be searched for programs that we execute. |
84 // (--exec-path path) | |
5794 | 85 static std::string VEXEC_PATH; |
2203 | 86 |
87 // Name of the editor to be invoked by the edit_history command. | |
5794 | 88 std::string VEDITOR; |
2203 | 89 |
5814 | 90 static std::string VIMAGE_PATH; |
2203 | 91 |
3523 | 92 std::string Vlocal_site_defaults_file; |
93 std::string Vsite_defaults_file; | |
2203 | 94 |
6274 | 95 std::string |
3523 | 96 subst_octave_home (const std::string& s) |
2203 | 97 { |
3523 | 98 std::string retval; |
2203 | 99 |
3523 | 100 std::string prefix = OCTAVE_PREFIX; |
2203 | 101 |
102 retval = s; | |
103 | |
104 if (Voctave_home != prefix) | |
105 { | |
5275 | 106 octave_idx_type len = prefix.length (); |
6276 | 107 |
108 if (s.substr (0, len) == prefix) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
109 retval.replace (0, len, Voctave_home); |
2203 | 110 } |
111 | |
8007
a2ab20ba78f7
make file_ops a proper singleton class
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
112 if (file_ops::dir_sep_char () != '/') |
a2ab20ba78f7
make file_ops a proper singleton class
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
113 std::replace (retval.begin (), retval.end (), '/', |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
114 file_ops::dir_sep_char ()); |
6114 | 115 |
2203 | 116 return retval; |
117 } | |
118 | |
119 static void | |
120 set_octave_home (void) | |
121 { | |
3523 | 122 std::string oh = octave_env::getenv ("OCTAVE_HOME"); |
2203 | 123 |
3523 | 124 Voctave_home = oh.empty () ? std::string (OCTAVE_PREFIX) : oh; |
2203 | 125 } |
126 | |
127 static void | |
128 set_default_info_dir (void) | |
129 { | |
130 Vinfo_dir = subst_octave_home (OCTAVE_INFODIR); | |
131 } | |
132 | |
133 static void | |
3141 | 134 set_default_data_dir (void) |
135 { | |
136 Vdata_dir = subst_octave_home (OCTAVE_DATADIR); | |
137 } | |
138 | |
139 static void | |
140 set_default_libexec_dir (void) | |
141 { | |
142 Vlibexec_dir = subst_octave_home (OCTAVE_LIBEXECDIR); | |
143 } | |
144 | |
145 static void | |
2203 | 146 set_default_arch_lib_dir (void) |
147 { | |
148 Varch_lib_dir = subst_octave_home (OCTAVE_ARCHLIBDIR); | |
149 } | |
150 | |
151 static void | |
2439 | 152 set_default_local_arch_lib_dir (void) |
153 { | |
154 Vlocal_arch_lib_dir = subst_octave_home (OCTAVE_LOCALARCHLIBDIR); | |
155 } | |
156 | |
157 static void | |
5909 | 158 set_default_local_api_arch_lib_dir (void) |
159 { | |
160 Vlocal_api_arch_lib_dir = subst_octave_home (OCTAVE_LOCALAPIARCHLIBDIR); | |
161 } | |
162 | |
163 static void | |
3597 | 164 set_default_local_ver_arch_lib_dir (void) |
165 { | |
166 Vlocal_ver_arch_lib_dir = subst_octave_home (OCTAVE_LOCALVERARCHLIBDIR); | |
167 } | |
168 | |
169 static void | |
5814 | 170 set_default_local_ver_oct_file_dir (void) |
171 { | |
172 Vlocal_ver_oct_file_dir = subst_octave_home (OCTAVE_LOCALVEROCTFILEDIR); | |
173 } | |
174 | |
175 static void | |
176 set_default_local_api_oct_file_dir (void) | |
177 { | |
178 Vlocal_api_oct_file_dir = subst_octave_home (OCTAVE_LOCALAPIOCTFILEDIR); | |
179 } | |
180 | |
181 static void | |
182 set_default_local_oct_file_dir (void) | |
183 { | |
184 Vlocal_oct_file_dir = subst_octave_home (OCTAVE_LOCALOCTFILEDIR); | |
185 } | |
186 | |
187 static void | |
188 set_default_local_ver_fcn_file_dir (void) | |
189 { | |
190 Vlocal_ver_fcn_file_dir = subst_octave_home (OCTAVE_LOCALVERFCNFILEDIR); | |
191 } | |
192 | |
193 static void | |
194 set_default_local_api_fcn_file_dir (void) | |
195 { | |
196 Vlocal_api_fcn_file_dir = subst_octave_home (OCTAVE_LOCALAPIFCNFILEDIR); | |
197 } | |
198 | |
199 static void | |
200 set_default_local_fcn_file_dir (void) | |
201 { | |
202 Vlocal_fcn_file_dir = subst_octave_home (OCTAVE_LOCALFCNFILEDIR); | |
203 } | |
204 | |
205 static void | |
2203 | 206 set_default_fcn_file_dir (void) |
207 { | |
208 Vfcn_file_dir = subst_octave_home (OCTAVE_FCNFILEDIR); | |
209 } | |
210 | |
211 static void | |
5814 | 212 set_default_image_dir (void) |
213 { | |
214 Vimage_dir = subst_octave_home (OCTAVE_IMAGEDIR); | |
215 } | |
216 | |
217 static void | |
5397 | 218 set_default_oct_file_dir (void) |
219 { | |
220 Voct_file_dir = subst_octave_home (OCTAVE_OCTFILEDIR); | |
221 } | |
222 | |
223 static void | |
2203 | 224 set_default_bin_dir (void) |
225 { | |
226 Vbin_dir = subst_octave_home (OCTAVE_BINDIR); | |
227 } | |
228 | |
5814 | 229 void |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
230 set_exec_path (const std::string& path_arg) |
4447 | 231 { |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
232 std::string tpath = path_arg; |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
233 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
234 if (tpath.empty ()) |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
235 tpath = octave_env::getenv ("OCTAVE_EXEC_PATH"); |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
236 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
237 if (tpath.empty ()) |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
238 tpath = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
239 + Vlocal_api_arch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
240 + Vlocal_arch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
241 + Varch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
242 + Vbin_dir; |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
243 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
244 VEXEC_PATH = tpath; |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
245 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
246 // FIXME -- should we really be modifying PATH in the environment? |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
247 // The way things are now, Octave will ignore directories set in the |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
248 // PATH with calls like |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
249 // |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
250 // setenv ("PATH", "/my/path"); |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
251 // |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
252 // To fix this, I think Octave should be searching the combination of |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
253 // PATH and EXEC_PATH for programs that it executes instead of setting |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
254 // the PATH in the environment and relying on the shell to do the |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
255 // searching. |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
256 |
5814 | 257 // This is static so that even if set_exec_path is called more than |
258 // once, shell_path is the original PATH from the environment, | |
259 // before we start modifying it. | |
260 static std::string shell_path = octave_env::getenv ("PATH"); | |
261 | |
262 if (! shell_path.empty ()) | |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
263 tpath = shell_path + dir_path::path_sep_str () + tpath; |
5814 | 264 |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
265 octave_env::putenv ("PATH", tpath); |
5814 | 266 } |
267 | |
268 void | |
269 set_image_path (const std::string& path) | |
270 { | |
271 VIMAGE_PATH = "."; | |
272 | |
273 std::string tpath = path; | |
274 | |
275 if (tpath.empty ()) | |
276 tpath = octave_env::getenv ("OCTAVE_IMAGE_PATH"); | |
277 | |
278 if (! tpath.empty ()) | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
8007
diff
changeset
|
279 VIMAGE_PATH += dir_path::path_sep_str () + tpath; |
5814 | 280 |
5832 | 281 tpath = genpath (Vimage_dir, ""); |
282 | |
283 if (! tpath.empty ()) | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
8007
diff
changeset
|
284 VIMAGE_PATH += dir_path::path_sep_str () + tpath; |
5814 | 285 } |
286 | |
2203 | 287 static void |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
288 set_default_doc_cache_file (void) |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
289 { |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
290 std::string def_file = subst_octave_home (OCTAVE_DOC_CACHE_FILE); |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
291 |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
292 std::string env_file = octave_env::getenv ("OCTAVE_DOC_CACHE_FILE"); |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
293 |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
294 Vdoc_cache_file = env_file.empty () ? def_file : env_file; |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
295 } |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
296 |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
297 static void |
2203 | 298 set_default_info_file (void) |
299 { | |
3523 | 300 std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE); |
2512 | 301 |
3523 | 302 std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE"); |
2203 | 303 |
2926 | 304 Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file; |
2203 | 305 } |
306 | |
307 static void | |
308 set_default_info_prog (void) | |
309 { | |
3523 | 310 std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM"); |
2203 | 311 |
2926 | 312 if (oct_info_prog.empty ()) |
5794 | 313 Vinfo_program = "info"; |
2926 | 314 else |
5794 | 315 Vinfo_program = std::string (oct_info_prog); |
2203 | 316 } |
317 | |
4773 | 318 static void |
2203 | 319 set_default_editor (void) |
320 { | |
5794 | 321 VEDITOR = "emacs"; |
2203 | 322 |
3523 | 323 std::string env_editor = octave_env::getenv ("EDITOR"); |
2203 | 324 |
2926 | 325 if (! env_editor.empty ()) |
5794 | 326 VEDITOR = env_editor; |
2203 | 327 } |
328 | |
329 static void | |
330 set_local_site_defaults_file (void) | |
331 { | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
332 std::string lsf = octave_env::getenv ("OCTAVE_SITE_INITFILE"); |
5781 | 333 |
334 if (lsf.empty ()) | |
335 { | |
336 Vlocal_site_defaults_file = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); | |
337 Vlocal_site_defaults_file.append ("/octaverc"); | |
338 } | |
339 else | |
340 Vlocal_site_defaults_file = lsf; | |
2203 | 341 } |
342 | |
343 static void | |
344 set_site_defaults_file (void) | |
345 { | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
346 std::string sf = octave_env::getenv ("OCTAVE_VERSION_INITFILE"); |
5781 | 347 |
348 if (sf.empty ()) | |
349 { | |
350 Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); | |
351 Vsite_defaults_file.append ("/octaverc"); | |
352 } | |
353 else | |
354 Vsite_defaults_file = sf; | |
2203 | 355 } |
356 | |
357 void | |
358 install_defaults (void) | |
359 { | |
360 // OCTAVE_HOME must be set first! | |
361 | |
362 set_octave_home (); | |
363 | |
364 set_default_info_dir (); | |
365 | |
3141 | 366 set_default_data_dir (); |
367 | |
368 set_default_libexec_dir (); | |
369 | |
2203 | 370 set_default_arch_lib_dir (); |
371 | |
5909 | 372 set_default_local_ver_arch_lib_dir (); |
373 set_default_local_api_arch_lib_dir (); | |
2439 | 374 set_default_local_arch_lib_dir (); |
375 | |
5814 | 376 set_default_local_ver_oct_file_dir (); |
377 set_default_local_api_oct_file_dir (); | |
378 set_default_local_oct_file_dir (); | |
2203 | 379 |
5814 | 380 set_default_local_ver_fcn_file_dir (); |
381 set_default_local_api_fcn_file_dir (); | |
382 set_default_local_fcn_file_dir (); | |
383 | |
384 set_default_fcn_file_dir (); | |
5397 | 385 set_default_oct_file_dir (); |
386 | |
5814 | 387 set_default_image_dir (); |
388 | |
2203 | 389 set_default_bin_dir (); |
390 | |
5814 | 391 set_exec_path (); |
4447 | 392 |
5814 | 393 set_image_path (); |
2203 | 394 |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
395 set_default_doc_cache_file (); |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
396 |
2203 | 397 set_default_info_file (); |
398 | |
399 set_default_info_prog (); | |
400 | |
401 set_default_editor (); | |
402 | |
403 set_local_site_defaults_file (); | |
404 | |
405 set_site_defaults_file (); | |
406 } | |
407 | |
5794 | 408 DEFUN (EDITOR, args, nargout, |
409 "-*- texinfo -*-\n\ | |
10840 | 410 @deftypefn {Built-in Function} {@var{val} =} EDITOR ()\n\ |
5794 | 411 @deftypefnx {Built-in Function} {@var{old_val} =} EDITOR (@var{new_val})\n\ |
412 Query or set the internal variable that specifies the editor to\n\ | |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9132
diff
changeset
|
413 use with the @code{edit_history} command. The default value is taken from\n\ |
10840 | 414 the environment variable @w{@env{EDITOR}} when Octave starts. If the\n\ |
415 environment variable is not initialized, @w{@env{EDITOR}} will be set to\n\ | |
5794 | 416 @code{\"emacs\"}.\n\ |
417 @seealso{edit_history}\n\ | |
418 @end deftypefn") | |
2203 | 419 { |
5794 | 420 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EDITOR); |
2203 | 421 } |
422 | |
5794 | 423 DEFUN (EXEC_PATH, args, nargout, |
424 "-*- texinfo -*-\n\ | |
10840 | 425 @deftypefn {Built-in Function} {@var{val} =} EXEC_PATH ()\n\ |
5794 | 426 @deftypefnx {Built-in Function} {@var{old_val} =} EXEC_PATH (@var{new_val})\n\ |
427 Query or set the internal variable that specifies a colon separated\n\ | |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
428 list of directories to append to the shell PATH when executing external\n\ |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
429 programs. The initial value of is taken from the environment variable\n\ |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
430 @w{@env{OCTAVE_EXEC_PATH}}, but that value can be overridden by\n\ |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
431 the command line argument @option{--exec-path PATH}.\n\ |
5794 | 432 @end deftypefn") |
4217 | 433 { |
5794 | 434 octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH); |
4217 | 435 |
11298
cb94bdc74670
defaults.cc (FEXEC_PATH): only call set_exec_path if nargin is greater than zero
John W. Eaton <jwe@octave.org>
parents:
11294
diff
changeset
|
436 if (args.length () > 0) |
cb94bdc74670
defaults.cc (FEXEC_PATH): only call set_exec_path if nargin is greater than zero
John W. Eaton <jwe@octave.org>
parents:
11294
diff
changeset
|
437 set_exec_path (VEXEC_PATH); |
2203 | 438 |
5794 | 439 return retval; |
2203 | 440 } |
441 | |
5814 | 442 DEFUN (IMAGE_PATH, args, nargout, |
5794 | 443 "-*- texinfo -*-\n\ |
10840 | 444 @deftypefn {Built-in Function} {@var{val} =} IMAGE_PATH ()\n\ |
5814 | 445 @deftypefnx {Built-in Function} {@var{old_val} =} IMAGE_PATH (@var{new_val})\n\ |
5794 | 446 Query or set the internal variable that specifies a colon separated\n\ |
447 list of directories in which to search for image files.\n\ | |
448 @end deftypefn") | |
449 { | |
5814 | 450 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGE_PATH); |
5794 | 451 } |
452 | |
5780 | 453 DEFUN (OCTAVE_HOME, args, , |
454 "-*- texinfo -*-\n\ | |
455 @deftypefn {Built-in Function} {} OCTAVE_HOME ()\n\ | |
456 Return the name of the top-level Octave installation directory.\n\ | |
457 @end deftypefn") | |
458 { | |
459 octave_value retval; | |
2831 | 460 |
5780 | 461 if (args.length () == 0) |
462 retval = Voctave_home; | |
463 else | |
5823 | 464 print_usage (); |
5780 | 465 |
466 return retval; | |
5749 | 467 } |
3446 | 468 |
5749 | 469 DEFUNX ("OCTAVE_VERSION", FOCTAVE_VERSION, args, , |
470 "-*- texinfo -*-\n\ | |
471 @deftypefn {Built-in Function} {} OCTAVE_VERSION ()\n\ | |
472 Return the version number of Octave, as a string.\n\ | |
473 @end deftypefn") | |
474 { | |
475 octave_value retval; | |
476 | |
477 int nargin = args.length (); | |
478 | |
479 if (nargin == 0) | |
480 retval = OCTAVE_VERSION; | |
481 else | |
5823 | 482 print_usage (); |
5749 | 483 |
484 return retval; | |
2203 | 485 } |