changeset 26704:7c027116ee21

Don't run Matlab user rc files when started with '--no-init-file' (bug #55681). * version-rcfile: Check argv() for option '--no-init-file' before executing Matlab-compatible rc files startup.m and finish.m
author Rik <rik@octave.org>
date Sat, 09 Feb 2019 09:44:28 -0800
parents 29ea2369971d
children c13143821eef
files scripts/startup/version-rcfile
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/startup/version-rcfile	Sat Feb 09 16:43:11 2019 +0100
+++ b/scripts/startup/version-rcfile	Sat Feb 09 09:44:28 2019 -0800
@@ -26,10 +26,12 @@
   PAGER_FLAGS ('-e -X -P"-- less ?pB(%pB\\%):--. (f)orward, (b)ack, (q)uit$"');
 endif
 
-## For Matlab compatibility, run startup.m when starting Octave.
-if (exist ("startup.m", "file") == 2)
-  startup;  # No arg list here since startup might be a script.
+## Run Matlab-compatible personal rc files unless skipping user rc files.
+if (! any (strcmp ("--no-init-file", argv ())))
+  if (exist ("startup.m", "file") == 2)
+    startup;  # No arg list here since startup might be a script.
+  endif
+
+  ## Schedule finish.m to run when exiting Octave.
+  atexit ("__finish__");
 endif
-
-## For Matlab compatibility, schedule finish.m to run when exiting Octave.
-atexit ("__finish__");