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