Commit b29b0c8a authored by Morten Welinder's avatar Morten Welinder
Browse files

New GETENV function.

parent e9fb508d
......@@ -9,7 +9,8 @@ Jody:
* Rename 'Summary' menu -> 'Properties'
Morten:
* DATE2UNIX and UNIX2DATE.
* Added DATE2UNIX and UNIX2DATE.
* Added GETENV.
--------------------------------------------------------------------------
Gnumeric 1.0.0
......
......@@ -975,6 +975,34 @@ gnumeric_type (FunctionEvalInfo *ei, ExprList *expr_node_list)
/***************************************************************************/
static char *help_getenv = {
N_("@FUNCTION=GETENV\n"
"@SYNTAX=GETENV(string)\n"
"@DESCRIPTION="
"GETENV retrieves a value from the execution environment.\n"
"\n"
"If the variable specified by @STRING does not exist, #N/A! will "
"be returned. Note, that variable names are case sensitive.\n"
"@EXAMPLES=\n"
"\n"
"@SEEALSO=")
};
static Value *
gnumeric_getenv (FunctionEvalInfo *ei, Value **argv)
{
const char *var = value_peek_string (argv[0]);
const char *val = getenv (var);
if (val)
return value_new_string (val);
else
return value_new_error (ei->pos, gnumeric_err_NA);
}
/***************************************************************************/
void information_functions_init (void);
void
......@@ -1022,4 +1050,6 @@ information_functions_init (void)
&help_na, gnumeric_na);
function_add_nodes (cat, "type", NULL, "value",
&help_type, gnumeric_type);
function_add_args (cat, "getenv", "s", "string",
&help_getenv, gnumeric_getenv);
}
2002-01-04 Morten Welinder <terra@diku.dk>
* fn-information.c (gnumeric_getenv): New function.
2002-01-03 Morten Welinder <terra@diku.dk>
* fn-date.c (gnumeric_date2unix): New function.
......
......@@ -975,6 +975,34 @@ gnumeric_type (FunctionEvalInfo *ei, ExprList *expr_node_list)
/***************************************************************************/
static char *help_getenv = {
N_("@FUNCTION=GETENV\n"
"@SYNTAX=GETENV(string)\n"
"@DESCRIPTION="
"GETENV retrieves a value from the execution environment.\n"
"\n"
"If the variable specified by @STRING does not exist, #N/A! will "
"be returned. Note, that variable names are case sensitive.\n"
"@EXAMPLES=\n"
"\n"
"@SEEALSO=")
};
static Value *
gnumeric_getenv (FunctionEvalInfo *ei, Value **argv)
{
const char *var = value_peek_string (argv[0]);
const char *val = getenv (var);
if (val)
return value_new_string (val);
else
return value_new_error (ei->pos, gnumeric_err_NA);
}
/***************************************************************************/
void information_functions_init (void);
void
......@@ -1022,4 +1050,6 @@ information_functions_init (void)
&help_na, gnumeric_na);
function_add_nodes (cat, "type", NULL, "value",
&help_type, gnumeric_type);
function_add_args (cat, "getenv", "s", "string",
&help_getenv, gnumeric_getenv);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment