[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ChangeSet]: setenv/putenv
From: |
David Bateman |
Subject: |
[ChangeSet]: setenv/putenv |
Date: |
Mon, 05 May 2008 14:27:11 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080306) |
The equivalent of the Octave putenv function in matlab is called
setenv.. Also the matlab setenv function accepts a single argument and
then assumes the second is an empty string. The attached patch
addresses this.
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1209990263 -7200
# Node ID 932a992e64ea6046ffb45e1ff1aa7df73f647ca0
# Parent 5fab58ec2c715bcb012a2c64ace2dc725275626a
Alias setenv to putenv. Allow single arg to putenv
diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@ 2008-05-05 John W. Eaton <address@hidden
+2008-05-05 David Bateman <address@hidden>
+
+ * sysdep.cc (Fputenv): Allow single arg. Alias to setenv.
+
2008-05-05 John W. Eaton <address@hidden>
* input.cc (Fre_read_readline_init_file): New function.
diff --git a/src/sysdep.cc b/src/sysdep.cc
--- a/src/sysdep.cc
+++ b/src/sysdep.cc
@@ -623,6 +623,7 @@ DEFUN (putenv, args, ,
DEFUN (putenv, args, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} putenv (@var{var}, @var{value})\n\
address@hidden {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 @@ Set the value of the environment variabl
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 @@ Set the value of the environment variabl
return retval;
}
+DEFALIAS (setenv, putenv);
// FIXME -- perhaps kbhit should also be able to print a prompt?
- [ChangeSet]: setenv/putenv,
David Bateman <=