diff options
author | Bruno Haible <bruno@clisp.org> | 2003-02-13 21:42:29 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:09:16 +0200 |
commit | 333ca1bdea2321fbd10488a7c29f6534572e03a2 (patch) | |
tree | 94e45e16dc6207c6567abb00233f7f53f9c6e4f0 /gettext-tools/lib/xsetenv.c | |
parent | 9ec3fdde7c736d5195c2d28b6824924a92bbb8d7 (diff) | |
download | external_gettext-333ca1bdea2321fbd10488a7c29f6534572e03a2.zip external_gettext-333ca1bdea2321fbd10488a7c29f6534572e03a2.tar.gz external_gettext-333ca1bdea2321fbd10488a7c29f6534572e03a2.tar.bz2 |
Move lib/xsetenv.c to gettext-tools/lib/xsetenv.c.
Diffstat (limited to 'gettext-tools/lib/xsetenv.c')
-rw-r--r-- | gettext-tools/lib/xsetenv.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gettext-tools/lib/xsetenv.c b/gettext-tools/lib/xsetenv.c new file mode 100644 index 0000000..43537f6 --- /dev/null +++ b/gettext-tools/lib/xsetenv.c @@ -0,0 +1,41 @@ +/* Setting environment variables, with out-of-memory checking. + Copyright (C) 2001-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +/* Specification. */ +#include "xsetenv.h" + +#include "setenv.h" +#include "error.h" +#include "exit.h" +#include "gettext.h" + +#define _(str) gettext (str) + + +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. + With error checking. */ +void +xsetenv (const char *name, const char *value, int replace) +{ + if (setenv (name, value, replace) < 0) + error (EXIT_FAILURE, 0, _("memory exhausted")); +} |