Mercurial > hg > octave-nkf
diff scripts/help/type.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | b584c07cd818 |
line wrap: on
line diff
--- a/scripts/help/type.m +++ b/scripts/help/type.m @@ -21,12 +21,12 @@ ## @deftypefnx {Command} {} type -q @var{name} @dots{} ## @deftypefnx {Function File} {dfns =} type ("@var{name}", @dots{}) ## Display the definition of each @var{name} that refers to a function. -## +## ## Normally also displays whether each @var{name} is user-defined or built-in; ## the @option{-q} option suppresses this behavior. ## -## If an output argument is requested nothing is displayed. Instead, a cell -## array of strings is returned, where each element corresponds to the +## If an output argument is requested nothing is displayed. Instead, a cell +## array of strings is returned, where each element corresponds to the ## definition of each requested function. ## @end deftypefn @@ -39,7 +39,7 @@ if (!iscellstr (varargin)) error ("type: input arguments must be strings"); endif - + quiet = false; idx = strcmpi (varargin, "-q") | strcmpi (varargin, "-quiet"); if (any (idx)) @@ -50,10 +50,10 @@ if (nargout > 0) retval = cell (size (varargin)); endif - + for n = 1:length (varargin) name = varargin {n}; - + ## Find function and get its code text = ""; cmd = sprintf ("exist ('%s')", name); @@ -75,7 +75,7 @@ ## FIXME: Should we just print it anyway? error ("type: `%s' undefined\n", name); endif - + ## Read the file fid = fopen (file, "r"); if (fid < 0) @@ -83,13 +83,13 @@ endif contents = char (fread (fid).'); fclose (fid); - + if (quiet) text = contents; else text = sprintf ("%s is the user-defined function defined from: %s\n\n%s", name, file, contents); - endif + endif elseif (e == 3) text = sprintf ("%s is a dynamically-linked function", name); elseif (e == 5)