OSDN Git Service

LDP: Update draft based on the previous commit
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / putenv.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\"     Single UNIX Specification, Version 2
30 .\" Modified Thu Apr  8 15:00:12 1993, David Metcalfe
31 .\" Modified Sat Jul 24 18:44:45 1993, Rik Faith (faith@cs.unc.edu)
32 .\" Modified Fri Feb 14 21:47:50 1997 by Andries Brouwer (aeb@cwi.nl)
33 .\" Modified Mon Oct 11 11:11:11 1999 by Andries Brouwer (aeb@cwi.nl)
34 .\" Modified Wed Nov 10 00:02:26 1999 by Andries Brouwer (aeb@cwi.nl)
35 .\" Modified Sun May 20 22:17:20 2001 by Andries Brouwer (aeb@cwi.nl)
36 .\"*******************************************************************
37 .\"
38 .\" This file was generated with po4a. Translate the source file.
39 .\"
40 .\"*******************************************************************
41 .\"
42 .\" Japanese Version Copyright (c) 1997 HIROFUMI Nishizuka
43 .\"     all rights reserved.
44 .\" Translated 1997-12-19, HIROFUMI Nishizuka <nishi@rpts.cl.nec.co.jp>
45 .\" Updated 2000-06-18, Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2005-11-19, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
47 .\"
48 .TH PUTENV 3 2019\-03\-06 GNU "Linux Programmer's Manual"
49 .SH 名前
50 putenv \- 環境変数の変更または追加
51 .SH 書式
52 .nf
53 \fB#include <stdlib.h>\fP
54 .PP
55 .\" Not: const char *
56 \fBint putenv(char *\fP\fIstring\fP\fB);\fP
57 .fi
58 .PP
59 .RS -4
60 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
61 .RE
62 .PP
63 \fBputenv\fP():
64 _XOPEN_SOURCE
65     || /* Glibc since 2.19: */ _DEFAULT_SOURCE
66     || /* Glibc versions <= 2.19: */ _SVID_SOURCE
67 .SH 説明
68 \fBputenv\fP()  関数は、環境変数の追加または値の変更を行う。 引数 \fIstring\fP は \fIname\fP=\fIvalue\fP
69 という形式を取る。 \fIname\fP が環境に存在しない場合は \fIstring\fP が環境に追加される。 \fIname\fP が環境に存在する場合は
70 \fIname\fP の値は \fIvalue\fP に変更される。 \fIstring\fP が指している文字列は環境の一部となるので、
71 文字列を変更すると環境も変更される。
72 .SH 返り値
73 \fBputenv\fP() 関数は、成功すると 0 を返し、エラーの場合は 0 以外の値を返す。エラーが発生した場合、 \fIerrno\fP
74 に原因を示す値が設定される。
75 .SH エラー
76 .TP 
77 \fBENOMEM\fP
78 新しい環境を割り当てるのに十分な空きがない。
79 .SH 属性
80 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
81 .TS
82 allbox;
83 lb lb lb
84 l l l.
85 インターフェース        属性  値
86 T{
87 \fBputenv\fP()
88 T}      Thread safety   MT\-Unsafe const:env
89 .TE
90 .SH 準拠
91 POSIX.1\-2001, POSIX.1\-2008, SVr4, 4.3BSD.
92 .SH 注意
93 .\" .LP
94 .\" Description for libc4, libc5, glibc:
95 .\" If the argument \fIstring\fP is of the form \fIname\fP,
96 .\" and does not contain an \(aq=\(aq character, then the variable \fIname\fP
97 .\" is removed from the environment.
98 .\" If
99 .\" .BR putenv ()
100 .\" has to allocate a new array \fIenviron\fP,
101 .\" and the previous array was also allocated by
102 .\" .BR putenv (),
103 .\" then it will be freed.
104 .\" In no case will the old storage associated
105 .\" to the environment variable itself be freed.
106 \fBputenv\fP()  はリエントラントであることを求められていない。 glibc 2.0 ではリエントラントではない。 glibc 2.1
107 ではリエントラントである。
108 .PP
109 Since version 2.1.2, the glibc implementation conforms to SUSv2: the pointer
110 \fIstring\fP given to \fBputenv\fP()  is used.  In particular, this string becomes
111 part of the environment; changing it later will change the environment.
112 (Thus, it is an error to call \fBputenv\fP()  with an automatic variable as the
113 argument, then return from the calling function while \fIstring\fP is still
114 part of the environment.)  However, glibc versions 2.0 to 2.1.1 differ: a
115 copy of the string is used.  On the one hand this causes a memory leak, and
116 on the other hand it violates SUSv2.
117 .PP
118 4.4BSD バージョンでは、glibc 2.0 と同様にコピーを使う。
119 .PP
120 SUSv2 ではプロトタイプから \fIconst\fP が取り除かれており、 glibc 2.1.3 もそのようになっている。
121 .PP
122 The GNU C library implementation provides a nonstandard extension.  If
123 \fIstring\fP does not include an equal sign:
124 .PP
125 .in +4n
126 .EX
127 putenv("NAME");
128 .EE
129 .in
130 .PP
131 then the named variable is removed from the caller's environment.
132 .SH 関連項目
133 \fBclearenv\fP(3), \fBgetenv\fP(3), \fBsetenv\fP(3), \fBunsetenv\fP(3), \fBenviron\fP(7)
134 .SH この文書について
135 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
136 \%https://www.kernel.org/doc/man\-pages/ に書かれている。