Mercurial > hg > octave-lojdl > gnulib-hg
annotate lib/setenv.h @ 5102:d39dc0b72f5b
* getndelim2.c: Include stddef.h, for ptrdiff_t.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 10 Jul 2004 07:58:10 +0000 |
parents | e2dea0e5b24a |
children | 20b173a370ec |
rev | line source |
---|---|
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
1 /* Setting environment variables. |
4591
e2dea0e5b24a
Indent nested cpp directive.
Jim Meyering <jim@meyering.net>
parents:
4084
diff
changeset
|
2 Copyright (C) 2001-2003 Free Software Foundation, Inc. |
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
3 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
6 the Free Software Foundation; either version 2, or (at your option) |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
7 any later version. |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
8 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
12 GNU General Public License for more details. |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
13 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
15 along with this program; if not, write to the Free Software Foundation, |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
17 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
18 #if HAVE_SETENV || HAVE_UNSETENV |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
19 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
20 /* Get setenv(), unsetenv() declarations. */ |
4591
e2dea0e5b24a
Indent nested cpp directive.
Jim Meyering <jim@meyering.net>
parents:
4084
diff
changeset
|
21 # include <stdlib.h> |
575 | 22 |
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
23 #endif |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
24 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
25 #ifdef __cplusplus |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
26 extern "C" { |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
27 #endif |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
28 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
29 #if !HAVE_SETENV |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
30 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
31 /* Set NAME to VALUE in the environment. |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
32 If REPLACE is nonzero, overwrite an existing value. */ |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
33 extern int setenv (const char *name, const char *value, int replace); |
575 | 34 |
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
35 #endif |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
36 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
37 #if !HAVE_UNSETENV |
575 | 38 |
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
39 /* Remove the variable NAME from the environment. */ |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
40 extern int unsetenv (const char *name); |
575 | 41 |
4084
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
42 #endif |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
43 |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
44 #ifdef __cplusplus |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
45 } |
5248d7d55666
Rewritten to cope with systems that have setenv() but not unsetenv().
Bruno Haible <bruno@clisp.org>
parents:
653
diff
changeset
|
46 #endif |