2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function putenv().
16 /*****************************************************************************
27 Change or add an environment variable.
30 string - Is of the form "name=value", where name is the variable's
31 name and value is its value. In case the string is of the form
32 "name" then the variable is removed from the environment.
34 The putenv() function returns zero on success, or -1 if an
35 error occurs. In such a case the errno variable is set
39 This function must not be used in a shared library.
40 Conforming to BSD4.4 in that it makes a copy of the argument string.
50 ******************************************************************************/
52 char *name
= NULL
, *value
= NULL
, *ptr
;
61 name
= strdup(string
);
64 for (ptr
=name
; *ptr
!='\0' && *ptr
!='='; ptr
++)
73 /* No value means we have to delete the variable */
75 res
= 0, unsetenv(name
);
77 /* we might have a value to get */
80 *ptr
= '\0'; /* terminate the name string */
82 res
= setenv(name
, value
, 1);