r6831@lvps87-230-33-50: verhaegs | 2008-02-03 14:08:57 +0100
[tangerine.git] / compiler / clib / setenv.c
blobe677c8dd13dd1314e934a6383cba082c4397720a
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function setenv().
6 */
8 #include <proto/dos.h>
9 #include <dos/var.h>
10 #include "__env.h"
12 /*****************************************************************************
14 NAME */
15 #include <stdlib.h>
17 int setenv (
19 /* SYNOPSIS */
20 const char *name,
21 const char *value,
22 int overwrite)
23 /* FUNCTION
24 Change or add an environment variable.
26 INPUTS
27 name - Name of the environment variable,
28 value - Value wich the variable must be set or changed to.
29 overwrite - If non-zero then, if a variable with the name name already
30 exists, its value is changet to value, otherwise is not
31 changed
33 RESULT
34 Returns zero on success, or -1 if there was insufficient
35 space in the environment.
37 NOTES
38 This function must not be used in a shared library.
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 ******************************************************************************/
50 if (!overwrite && FindVar(name, LV_VAR))
51 return 0;
53 return -!SetVar(name, value, -1, LV_VAR | GVF_LOCAL_ONLY);
54 } /* setenv */