.\" -*- coding: UTF-8 -*- '\" t .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Single UNIX Specification, Version 2 .\" Modified Thu Apr 8 15:00:12 1993, David Metcalfe .\" Modified Sat Jul 24 18:44:45 1993, Rik Faith (faith@cs.unc.edu) .\" Modified Fri Feb 14 21:47:50 1997 by Andries Brouwer (aeb@cwi.nl) .\" Modified Mon Oct 11 11:11:11 1999 by Andries Brouwer (aeb@cwi.nl) .\" Modified Wed Nov 10 00:02:26 1999 by Andries Brouwer (aeb@cwi.nl) .\" Modified Sun May 20 22:17:20 2001 by Andries Brouwer (aeb@cwi.nl) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH putenv 3 "20 июля 2023 г." "Linux man\-pages 6.05.01" .SH ИМЯ putenv \- изменяет или добавляет переменную окружения .SH LIBRARY Standard C library (\fIlibc\fP, \fI\-lc\fP) .SH СИНТАКСИС .nf \fB#include \fP .PP .\" Not: const char * \fBint putenv(char *\fP\fIstring\fP\fB);\fP .fi .PP .RS -4 Требования макроса тестирования свойств для glibc (см. \fBfeature_test_macros\fP(7)): .RE .PP \fBputenv\fP(): .nf _XOPEN_SOURCE || /* glibc >= 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE .fi .SH ОПИСАНИЕ Функция \fBputenv\fP() добавляет или изменяет значение переменных окружения. Аргумент \fIstring\fP должен быть представлен в форме \fIname\fP=\fIvalue\fP. Если переменной с именем \fIname\fP нет в окружении, то \fIstring\fP добавляется к окружению. Если переменная \fIname\fP уже существует, то значение \fIname\fP в окружении изменяется на \fIvalue\fP. Строка, на которую указывает \fIstring\fP, становится частью окружения, так что её изменение приведёт к изменению окружения. .SH "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" The \fBputenv\fP() function returns zero on success. On failure, it returns a nonzero value, and \fIerrno\fP is set to indicate the error. .SH ОШИБКИ .TP \fBENOMEM\fP Недостаточно памяти под новое окружение. .SH АТРИБУТЫ Описание терминов данного раздела смотрите в \fBattributes\fP(7). .TS allbox; lbx lb lb l l l. Интерфейс Атрибут Значение T{ .na .nh \fBputenv\fP() T} Безвредность в нитях MT\-Unsafe const:env .TE .sp 1 .SH СТАНДАРТЫ POSIX.1\-2008. .SH ИСТОРИЯ POSIX.1\-2001, SVr2, 4.3BSD\-Reno. .PP .\" .LP .\" Description for libc4, libc5, glibc: .\" If the argument \fIstring\fP is of the form \fIname\fP, .\" and does not contain an \[aq]=\[aq] character, then the variable \fIname\fP .\" is removed from the environment. .\" If .\" .BR putenv () .\" has to allocate a new array \fIenviron\fP, .\" and the previous array was also allocated by .\" .BR putenv (), .\" then it will be freed. .\" In no case will the old storage associated .\" to the environment variable itself be freed. От функции \fBputenv\fP() не требуется быть реентерабельной, и она такова в glibc 2.0, но в glibc 2.1 она реентерабельна. .PP Since glibc 2.1.2, the glibc implementation conforms to SUSv2: the pointer \fIstring\fP given to \fBputenv\fP() 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 \fBputenv\fP() with an automatic variable as the argument, then return from the calling function while \fIstring\fP is still part of the environment.) However, from glibc 2.0 to glibc 2.1.1, it differs: a copy of the string is used. On the one hand this causes a memory leak, and on the other hand it violates SUSv2. .PP The 4.3BSD\-Reno version, like glibc 2.0, uses a copy; this is fixed in all modern BSDs. .PP В SUSv2 удалено \fIconst\fP из прототипа и это сделано в glibc 2.1.3. .PP Реализация библиотеки GNU C предоставляет нестандартное расширение. Если \fIstring\fP не включает знака равно: .PP .in +4n .EX putenv("NAME"); .EE .in .PP то именованная переменная удаляется из окружения вызывающего. .SH "СМ. ТАКЖЕ" \fBclearenv\fP(3), \fBgetenv\fP(3), \fBsetenv\fP(3), \fBunsetenv\fP(3), \fBenviron\fP(7) .PP .SH ПЕРЕВОД Русский перевод этой страницы руководства был сделан Alexey, Azamat Hackimov , kogamatranslator49 , Kogan, Max Is , Yuri Kozlov и Иван Павлов . .PP Этот перевод является бесплатной документацией; прочитайте .UR https://www.gnu.org/licenses/gpl-3.0.html Стандартную общественную лицензию GNU версии 3 .UE или более позднюю, чтобы узнать об условиях авторского права. Мы не несем НИКАКОЙ ОТВЕТСТВЕННОСТИ. .PP Если вы обнаружите ошибки в переводе этой страницы руководства, пожалуйста, отправьте электронное письмо на .MT man-pages-ru-talks@lists.sourceforge.net .ME .