xref: /netbsd-src/external/gpl2/xcvs/dist/lib/setenv.h (revision a7c918477dd5f12c1da816ba05caf44eab2d06d6)
1*a7c91847Schristos /* Setting environment variables.
2*a7c91847Schristos    Copyright (C) 2001-2004 Free Software Foundation, Inc.
3*a7c91847Schristos 
4*a7c91847Schristos    This program is free software; you can redistribute it and/or modify
5*a7c91847Schristos    it under the terms of the GNU General Public License as published by
6*a7c91847Schristos    the Free Software Foundation; either version 2, or (at your option)
7*a7c91847Schristos    any later version.
8*a7c91847Schristos 
9*a7c91847Schristos    This program is distributed in the hope that it will be useful,
10*a7c91847Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*a7c91847Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*a7c91847Schristos    GNU General Public License for more details.
13*a7c91847Schristos 
14*a7c91847Schristos    You should have received a copy of the GNU General Public License
15*a7c91847Schristos    along with this program; if not, write to the Free Software Foundation,
16*a7c91847Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17*a7c91847Schristos 
18*a7c91847Schristos #if HAVE_SETENV || HAVE_UNSETENV
19*a7c91847Schristos 
20*a7c91847Schristos /* Get setenv(), unsetenv() declarations.  */
21*a7c91847Schristos # include <stdlib.h>
22*a7c91847Schristos 
23*a7c91847Schristos #endif
24*a7c91847Schristos 
25*a7c91847Schristos #ifdef	__cplusplus
26*a7c91847Schristos extern "C" {
27*a7c91847Schristos #endif
28*a7c91847Schristos 
29*a7c91847Schristos #if !HAVE_SETENV
30*a7c91847Schristos 
31*a7c91847Schristos /* Set NAME to VALUE in the environment.
32*a7c91847Schristos    If REPLACE is nonzero, overwrite an existing value.  */
33*a7c91847Schristos extern int setenv (const char *name, const char *value, int replace);
34*a7c91847Schristos 
35*a7c91847Schristos #endif
36*a7c91847Schristos 
37*a7c91847Schristos #if HAVE_UNSETENV
38*a7c91847Schristos 
39*a7c91847Schristos # if VOID_UNSETENV
40*a7c91847Schristos /* On some systems, unsetenv() returns void.
41*a7c91847Schristos    This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
42*a7c91847Schristos #  define unsetenv(name) ((unsetenv)(name), 0)
43*a7c91847Schristos # endif
44*a7c91847Schristos 
45*a7c91847Schristos #else
46*a7c91847Schristos 
47*a7c91847Schristos /* Remove the variable NAME from the environment.  */
48*a7c91847Schristos extern int unsetenv (const char *name);
49*a7c91847Schristos 
50*a7c91847Schristos #endif
51*a7c91847Schristos 
52*a7c91847Schristos #ifdef	__cplusplus
53*a7c91847Schristos }
54*a7c91847Schristos #endif
55