1 |
/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc. |
/* Copyright (C) 1992, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. |
2 |
This file based on setenv.c in the GNU C Library. |
This file based on setenv.c in the GNU C Library. |
3 |
|
|
4 |
The GNU C Library is free software; you can redistribute it and/or |
The GNU C Library is free software; you can redistribute it and/or |
16 |
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 |
Boston, MA 02111-1307, USA. */ |
Boston, MA 02111-1307, USA. */ |
18 |
|
|
19 |
|
|
20 |
|
/* |
21 |
|
|
22 |
|
@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite}) |
23 |
|
@deftypefnx Supplemental void unsetenv (const char *@var{name}) |
24 |
|
|
25 |
|
@code{setenv} adds @var{name} to the environment with value |
26 |
|
@var{value}. If the name was already present in the environment, |
27 |
|
the new value will be stored only if @var{overwrite} is nonzero. |
28 |
|
The companion @code{unsetenv} function removes @var{name} from the |
29 |
|
environment. This implementation is not safe for multithreaded code. |
30 |
|
|
31 |
|
@end deftypefn |
32 |
|
|
33 |
|
*/ |
34 |
|
|
35 |
#if HAVE_CONFIG_H |
#if HAVE_CONFIG_H |
36 |
# include <config.h> |
# include <config.h> |
37 |
#endif |
#endif |
38 |
|
|
39 |
|
#define setenv libiberty_setenv |
40 |
|
#define unsetenv libiberty_unsetenv |
41 |
|
|
42 |
#include "ansidecl.h" |
#include "ansidecl.h" |
43 |
#include <sys/types.h> /* For `size_t' */ |
#include <sys/types.h> /* For `size_t' */ |
44 |
#include <stdio.h> /* For `NULL' */ |
#include <stdio.h> /* For `NULL' */ |
64 |
extern char **environ; |
extern char **environ; |
65 |
#endif |
#endif |
66 |
|
|
67 |
|
#undef setenv |
68 |
|
#undef unsetenv |
69 |
|
|
70 |
/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty |
/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty |
71 |
* implementation MT-Unsafe. */ |
* implementation MT-Unsafe. */ |
72 |
#define LOCK |
#define LOCK |