Mercurial > hg > octave-lyh
changeset 7759:84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 05 May 2008 11:20:02 -0400 |
parents | 8e14a01ffe9f |
children | f5268d7045d7 |
files | src/ChangeLog src/sysdep.cc |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-05-05 David Bateman <dbateman@free.fr> + + * sysdep.cc (Fputenv): Allow single arg. Alias to setenv. + 2008-05-05 John W. Eaton <jwe@octave.org> * input.cc (Fre_read_readline_init_file): New function.
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -623,6 +623,7 @@ DEFUN (putenv, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} putenv (@var{var}, @var{value})\n\ +@deftypefnx {Built-in Function} {} setenv (@var{var}, @var{value})\n\ Set the value of the environment variable @var{var} to @var{value}.\n\ @end deftypefn") { @@ -630,13 +631,14 @@ int nargin = args.length (); - if (nargin == 2) + if (nargin == 2 || nargin == 1) { std::string var = args(0).string_value (); if (! error_state) { - std::string val = args(1).string_value (); + std::string val = (nargin == 2 + ? args(1).string_value () : std::string ()); if (! error_state) octave_env::putenv (var, val); @@ -651,6 +653,7 @@ return retval; } +DEFALIAS (setenv, putenv); // FIXME -- perhaps kbhit should also be able to print a prompt?