tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / compiler / posixc / setenv.c
blob3a6aa7c71b011c3dafc3c3305e91219315d43873
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2008 function setenv().
6 */
8 #include <proto/dos.h>
9 #include <dos/var.h>
11 /*****************************************************************************
13 NAME */
14 #include <stdlib.h>
16 int setenv (
18 /* SYNOPSIS */
19 const char *name,
20 const char *value,
21 int overwrite)
22 /* FUNCTION
23 Change or add an environment variable.
25 INPUTS
26 name - Name of the environment variable,
27 value - Value wich the variable must be set or changed to.
28 overwrite - If non-zero then, if a variable with the name name already
29 exists, its value is changet to value, otherwise is not
30 changed
32 RESULT
33 Returns zero on success, or -1 if there was insufficient
34 space in the environment.
36 NOTES
37 This function must not be used in a shared library.
39 EXAMPLE
41 BUGS
43 SEE ALSO
45 INTERNALS
47 ******************************************************************************/
49 if (!overwrite && FindVar(name, LV_VAR))
50 return 0;
52 return -!SetVar(name, value, -1, LV_VAR | GVF_LOCAL_ONLY);
53 } /* setenv */