2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
8 #include <proto/exec.h>
13 /*****************************************************************************
24 Get an environment variable.
27 name - Name of the environment variable.
30 Pointer to the variable's value, or NULL on failure.
33 This function must not be used in a shared library.
42 Based on libnix getenv
44 ******************************************************************************/
46 __env_item
*var
= NULL
;
50 This will always return 0 if the var exists and EOF if it doesn't,
51 then we'll be able to retrieve the var lenght with IoErr()
53 if (!GetVar((char *)name
, &c
, 1, GVF_BINARY_VAR
))
57 var
= __env_getvar(name
, len
+1); /* size == len + null-byte. */
61 /*This should not fail, unless someone stealt our variable*/
62 /* FIXME: maybe this function should be atomic? */
63 GetVar((char *)name
, var
->value
, len
+1, GVF_BINARY_VAR
);
67 return (var
?var
->value
:NULL
);