diff scripts/miscellaneous/run.m @ 11469:c776f063fefe

Overhaul m-script files to use common variable name between code and documentation.
author Rik <octave@nomad.inbox5.com>
date Sun, 09 Jan 2011 12:41:21 -0800
parents 0754a4e271f4
children 1740012184f9
line wrap: on
line diff
--- a/scripts/miscellaneous/run.m	Sun Jan 09 21:24:43 2011 +0100
+++ b/scripts/miscellaneous/run.m	Sun Jan 09 12:41:21 2011 -0800
@@ -17,22 +17,22 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Command} {} run @var{f}
-## @deftypefnx {Function File} {} run (@var{f})
+## @deftypefn  {Command} {} run @var{script}
+## @deftypefnx {Function File} {} run (@var{script})
 ## Run scripts in the current workspace that are not necessarily on the
-## path.  If @var{f} is the script to run, including its path, then @code{run}
-## changes the directory to the directory where @var{f} is found.  @code{run}
+## path.  If @var{script} is the script to run, including its path, then @code{run}
+## changes the directory to the directory where @var{script} is found.  @code{run}
 ## then executes the script, and returns to the original directory.
 ## @seealso{system}
 ## @end deftypefn
 
-function run (s)
+function run (script)
 
   if (nargin != 1)
     print_usage ();
   endif
 
-  [d, f, ext] = fileparts (s);
+  [d, f, ext] = fileparts (script);
   if (! isempty (d))
     if (exist (d, "dir"))
       wd = pwd ();
@@ -50,11 +50,11 @@
       error ("run: the path %s doesn't exist", d);
     endif
   else
-    if (exist (s, "file"))
-      evalin ("caller", sprintf ("source (\"%s\");", s),
+    if (exist (script, "file"))
+      evalin ("caller", sprintf ("source (\"%s\");", script),
               "rethrow (lasterror ())");
     else
-      error ("run: %s not found", s);
+      error ("run: %s not found", script);
     endif
   endif
 endfunction