Blame gettext-tools/gnulib-lib/xsetenv.c
|
Packit Bot |
06c835 |
/* Setting environment variables, with out-of-memory checking.
|
|
Packit Bot |
06c835 |
Copyright (C) 2001-2002, 2005-2007, 2009-2015 Free Software Foundation, Inc.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
This program is free software: you can redistribute it and/or modify
|
|
Packit Bot |
06c835 |
it under the terms of the GNU General Public License as published by
|
|
Packit Bot |
06c835 |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit Bot |
06c835 |
(at your option) any later version.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
This program is distributed in the hope that it will be useful,
|
|
Packit Bot |
06c835 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Bot |
06c835 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Bot |
06c835 |
GNU General Public License for more details.
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
You should have received a copy of the GNU General Public License
|
|
Packit Bot |
06c835 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#include <config.h>
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/* Specification. */
|
|
Packit Bot |
06c835 |
#include "xsetenv.h"
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#include <stdlib.h>
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#include "error.h"
|
|
Packit Bot |
06c835 |
#include "gettext.h"
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
#define _(str) gettext (str)
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
|
|
Packit Bot |
06c835 |
/* Set NAME to VALUE in the environment.
|
|
Packit Bot |
06c835 |
If REPLACE is nonzero, overwrite an existing value.
|
|
Packit Bot |
06c835 |
With error checking. */
|
|
Packit Bot |
06c835 |
void
|
|
Packit Bot |
06c835 |
xsetenv (const char *name, const char *value, int replace)
|
|
Packit Bot |
06c835 |
{
|
|
Packit Bot |
06c835 |
if (setenv (name, value, replace) < 0)
|
|
Packit Bot |
06c835 |
error (EXIT_FAILURE, 0, _("memory exhausted"));
|
|
Packit Bot |
06c835 |
}
|