xref: /dflybsd-src/contrib/cvs-1.12/lib/setenv.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /* Setting environment variables.
286d7f5d3SJohn Marino    Copyright (C) 2001-2004 Free Software Foundation, Inc.
386d7f5d3SJohn Marino 
486d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
586d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
686d7f5d3SJohn Marino    the Free Software Foundation; either version 2, or (at your option)
786d7f5d3SJohn Marino    any later version.
886d7f5d3SJohn Marino 
986d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
1086d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1186d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1286d7f5d3SJohn Marino    GNU General Public License for more details.
1386d7f5d3SJohn Marino 
1486d7f5d3SJohn Marino    You should have received a copy of the GNU General Public License
1586d7f5d3SJohn Marino    along with this program; if not, write to the Free Software Foundation,
1686d7f5d3SJohn Marino    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1786d7f5d3SJohn Marino 
1886d7f5d3SJohn Marino #if HAVE_SETENV || HAVE_UNSETENV
1986d7f5d3SJohn Marino 
2086d7f5d3SJohn Marino /* Get setenv(), unsetenv() declarations.  */
2186d7f5d3SJohn Marino # include <stdlib.h>
2286d7f5d3SJohn Marino 
2386d7f5d3SJohn Marino #endif
2486d7f5d3SJohn Marino 
2586d7f5d3SJohn Marino #ifdef	__cplusplus
2686d7f5d3SJohn Marino extern "C" {
2786d7f5d3SJohn Marino #endif
2886d7f5d3SJohn Marino 
2986d7f5d3SJohn Marino #if !HAVE_SETENV
3086d7f5d3SJohn Marino 
3186d7f5d3SJohn Marino /* Set NAME to VALUE in the environment.
3286d7f5d3SJohn Marino    If REPLACE is nonzero, overwrite an existing value.  */
3386d7f5d3SJohn Marino extern int setenv (const char *name, const char *value, int replace);
3486d7f5d3SJohn Marino 
3586d7f5d3SJohn Marino #endif
3686d7f5d3SJohn Marino 
3786d7f5d3SJohn Marino #if HAVE_UNSETENV
3886d7f5d3SJohn Marino 
3986d7f5d3SJohn Marino # if VOID_UNSETENV
4086d7f5d3SJohn Marino /* On some systems, unsetenv() returns void.
4186d7f5d3SJohn Marino    This is the case for FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
4286d7f5d3SJohn Marino #  define unsetenv(name) ((unsetenv)(name), 0)
4386d7f5d3SJohn Marino # endif
4486d7f5d3SJohn Marino 
4586d7f5d3SJohn Marino #else
4686d7f5d3SJohn Marino 
4786d7f5d3SJohn Marino /* Remove the variable NAME from the environment.  */
4886d7f5d3SJohn Marino extern int unsetenv (const char *name);
4986d7f5d3SJohn Marino 
5086d7f5d3SJohn Marino #endif
5186d7f5d3SJohn Marino 
5286d7f5d3SJohn Marino #ifdef	__cplusplus
5386d7f5d3SJohn Marino }
5486d7f5d3SJohn Marino #endif
55