OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man3 / setenv.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright (C) 2004, 2007 Michael kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" References consulted:
27 .\"     Linux libc source code
28 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\"     386BSD man pages
30 .\" Modified Sat Jul 24 18:20:58 1993 by Rik Faith (faith@cs.unc.edu)
31 .\" Modified Fri Feb 14 21:47:50 1997 by Andries Brouwer (aeb@cwi.nl)
32 .\" Modified 9 Jun 2004, Michael Kerrisk <mtk.manpages@gmail.com>
33 .\"     Changed unsetenv() prototype; added EINVAL error
34 .\"     Noted nonstandard behavior of setenv() if name contains '='
35 .\" 2005-08-12, mtk, glibc 2.3.4 fixed the "name contains '='" bug
36 .\"
37 .\"*******************************************************************
38 .\"
39 .\" This file was generated with po4a. Translate the source file.
40 .\"
41 .\"*******************************************************************
42 .TH SETENV 3 2009\-09\-20 GNU "Linux Programmer's Manual"
43 .SH 名前
44 setenv \- 環境変数を変更または追加する
45 .SH 書式
46 .nf
47 \fB#include <stdlib.h>\fP
48 .sp
49 \fBint setenv(const char *\fP\fIname\fP\fB, const char *\fP\fIvalue\fP\fB, int \fP\fIoverwrite\fP\fB);\fP
50 .sp
51 \fBint unsetenv(const char *\fP\fIname\fP\fB);\fP
52 .fi
53 .sp
54 .in -4n
55 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
56 .in
57 .sp
58 .ad l
59 \fBsetenv\fP(), \fBunsetenv\fP():
60 .RS 4
61 _BSD_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
62 .RE
63 .ad b
64 .SH 説明
65 \fBsetenv\fP()  関数は、\fIname\fP が存在しない場合 環境変数 \fIname\fP に値 \fIvalue\fP を設定し、環境に追加する。
66 \fIname\fP が環境に存在する場合、\fIoverwrite\fP が 0 以外ならば その値を \fIvalue\fP に変更し、\fIoverwrite\fP が
67 0 ならば \fIname\fP の値を変更しない。 この関数は、 (\fBputenv\fP(3)  と違い)  \fIname\fP と \fIvalue\fP
68 により参照される文字列のコピーを行う。
69 .PP
70 \fBunsetenv\fP()  関数は、変数 \fIname\fP を環境から削除する。 \fIname\fP
71 が環境にない場合、この関数は成功し、環境は変更されない。
72 .SH 返り値
73 \fBsetenv\fP()  関数は、成功すると 0 を返す。 エラーの場合、\-1 を返し、 \fIerrno\fP にエラーの原因を示す値がセットされる。
74
75 \fBunsetenv\fP()  関数は、成功すると 0 を返す。 エラーの場合は \-1 を返し、 \fIerrno\fP を設定してエラーの原因を示す。
76 .SH エラー
77 .TP 
78 \fBEINVAL\fP
79 \fIname\fP が NULL であるか、長さが 0 の文字列を指しているか、 \(aq=\(aq 文字が含まれている。
80 .TP 
81 \fBENOMEM\fP
82 環境に新しい変数を追加するのに十分なメモリがない。
83 .SH 準拠
84 4.3BSD, POSIX.1\-2001.
85 .SH 注意
86 POSIX.1\-2001 は、 \fBsetenv\fP()  や \fBunsetenv\fP()  がリエントラント (再入可能) であることを要求していない。
87
88 glibc 2.2.2 以前では、 \fBunsetenv\fP()  は 返り値が \fIvoid\fP のプロトタイプであった。 もっと最近の glibc
89 版は、「書式」セクションで示しているように POSIX.1\-2001 互換のプロトタイプである。
90 .SH バグ
91 POSIX.1\-2001 では 「\fIname\fP に \(aq=\(aq 文字が含まれる場合、 \fBsetenv\fP()  はエラー \fBEINVAL\fP
92 で失敗すべきである」と述べられている。 しかし 2.3.4 より前のバージョンの glibc では、 \fIname\fP に \(aq=\(aq
93 文字が含まれるのを許している。
94 .SH 関連項目
95 \fBclearenv\fP(3), \fBgetenv\fP(3), \fBputenv\fP(3), \fBenviron\fP(7)
96 .SH この文書について
97 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
98 である。プロジェクトの説明とバグ報告に関する情報は
99 http://www.kernel.org/doc/man\-pages/ に書かれている。