sourCEntral - mobile manpages

pdf

putenv

NOMBRE

putenv - cambia o añade una variable de entorno

BIBLIOTECA

Biblioteca Estándar C (libc, -lc)

SINOPSIS

#include <stdlib.h>

int putenv(char *cadena);

Requisitos de Macros de Prueba de Características para glibc (véase feature_test_macros(7)):

putenv():
_XOPEN_SOURCE
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _SVID_SOURCE

DESCRIPCIÓN

La función putenv() añade o cambia el valor de variables de entorno o entorno. El argumento cadena es de la forma nombre=valor. Si nombre no existe ya en el entorno, entonces cadena se añade al entorno. Si nombre sí existe, entonces el valor de nombre en el entorno se cambia a valor. La cadena apuntada por cadena se convierte en parte del entorno, por lo que cambiar la cadena modifica el entorno.

VALOR DEVUELTO

The putenv() function returns zero on success. On failure, it returns a nonzero value, and errno is set to indicate the error.

ERRORES

ENOMEM

Espacio insuficiente para alojar el nuevo entorno.

ATRIBUTOS

Para obtener una explicación de los términos usados en esta sección, véase attributes(7).

img

ESTÁNDARES

POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.

NOTAS

The putenv() function is not required to be reentrant, and the one in glibc 2.0 is not, but the glibc 2.1 version is.

Since glibc 2.1.2, the glibc implementation conforms to SUSv2: the pointer string given to putenv() is used. In particular, this string becomes part of the environment; changing it later will change the environment. (Thus, it is an error to call putenv() with an automatic variable as the argument, then return from the calling function while string is still part of the environment.) However, from glibc 2.0 to glibc 2.1.1, it differs:r a copy of the string is used. On the one hand this causes a memory leak, and on the other hand it violates SUSv2.

La versión de 4.4BSD, como la de glibc 2.0, usa una copia.

SUSv2 elimina const del prototipo, y así lo hace glibc 2.1.3.

The GNU C library implementation provides a nonstandard extension. If string does not include an equal sign:

putenv("NAME");

then the named variable is removed from the caller’s environment.

VÉASE TAMBIÉN

clearenv(3), getenv(3), setenv(3), unsetenv(3), environ(7)

TRADUCCIÓN

La traducción al español de esta página del manual fue creada por Gerardo Aburruzaga García <gerardo DOT aburruzaga AT uca DOT es> y Juan Piernas <piernas AT ditec DOT um DOT es>

Esta traducción es documentación libre; lea la GNU General Public License Version 3 o posterior con respecto a las condiciones de copyright. No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a debian-l10n-spanish.

pdf