1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" based on the description in glibc source and infopages
5 .\" Corrections and additions, aeb
7 .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI, all rights reserved.
8 .\" Translated Mon Feb 2 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
10 .TH ENVZ_ADD 3 2007-05-18 "" "Linux Programmer's Manual"
13 .\"O envz_add, envz_entry, envz_get, envz_merge,
14 .\"O envz_remove, envz_strip \- environment string support
15 envz_add, envz_entry, envz_get, envz_merge,
16 envz_remove, envz_strip \- 環境変数文字列の操作
20 .B "#include <envz.h>"
22 .BI "error_t envz_add(char **" envz ", size_t *" envz_len ,
24 .BI "const char *" name ", const char *" value );
26 .BI "char *envz_entry(const char *" envz ", size_t *" envz_len \
27 ", const char *" name );
29 .BI "char *envz_get(const char *" envz ", size_t *" envz_len \
30 ", const char *" name );
32 .BI "error_t envz_merge(char **" envz ", size_t *" envz_len ,
34 .BI "const char *" envz2 ", size_t " envz2_len ", int " override );
36 .BI "void envz_remove(char **" envz ", size_t *" envz_len \
37 ", const char *" name );
39 .BI "void envz_strip(char **" envz ", size_t *" envz_len );
43 .\"O These functions are glibc-specific.
46 .\"O An argz vector is a pointer to a character buffer together with a length,
48 .\"O .BR argz_add (3).
49 .\"O An envz vector is a special argz vector, namely one where the strings
50 .\"O have the form "name=value".
51 .\"O Everything after the first \(aq=\(aq is considered
53 .\"O If there is no \(aq=\(aq, the value is taken to be NULL.
54 .\"O (While the value in case of a trailing \(aq=\(aq is the empty string "".)
55 argz vector は長さ情報付きの文字バッファへのポインタである。
58 envz vector は、文字列が "name=value (名前=値)" の形式になっている特別な
60 最初の \(aq=\(aq 以降はすべて値とみなされる。\(aq=\(aq がなければ、
61 値は NULL と解釈される。(文字列の一番最後の文字が \(aq=\(aq の場合、値は空文字列
64 .\"O These functions are for handling envz vectors.
65 これらの関数は envz vector を操作するためのものである。
69 .\"O .RI \&" name = value \&"
76 .\"O is NULL) to the envz vector
77 .\"O .RI ( *envz ,\ *envz_len )
82 .\"O If an entry with the same
84 .\"O existed, it is removed.
87 .RI \&" name = value \&"
94 .RI ( *envz ,\ *envz_len )
101 と同じ名前を持つエントリがあった場合、元のエントリは削除される。
103 .\"O .BR envz_entry ()
106 .\"O in the envz vector
107 .\"O .RI ( envz ,\ envz_len )
108 .\"O and returns the entry if found, or NULL if not.
111 .RI ( envz ,\ envz_len )
115 見つかった場合はそのエントリを返し、見つからなかった場合は NULL を返す。
120 .\"O in the envz vector
121 .\"O .RI ( envz ,\ envz_len )
122 .\"O and returns the value if found, or NULL if not.
123 .\"O (Note that the value can also be NULL, namely when there is
126 .\"O without \(aq=\(aq sign.)
129 .RI ( envz ,\ envz_len )
133 見つかった場合はエントリの値を返し、見つからなかった場合は NULL を返す。
134 (値は NULL の場合もあることに注意すること。名前が
136 のエントリに \(aq=\(aq 符号がない場合が該当する。)
138 .\"O .BR envz_merge ()
139 .\"O adds each entry in
144 .\"O .BR envz_add ().
147 .\"O is true, then values in
149 .\"O will supersede those with the same name in
168 .\"O .BR envz_remove ()
169 .\"O removes the entry for
172 .\"O .RI ( *envz ,\ *envz_len )
173 .\"O if there was one.
178 .RI ( *envz ,\ *envz_len )
181 .\"O .BR envz_strip ()
182 .\"O removes all entries with value NULL.
184 は、値が NULL のエントリをすべて削除する。
185 .\"O .SH "RETURN VALUE"
187 .\"O All envz functions that do memory allocation have a return type of
188 .\"O \fIerror_t\fP, and return 0 for success, and \fBENOMEM\fP
189 .\"O if an allocation error occurs.
190 メモリ割り当てを行う envz 関数群はすべて \fIerror_t\fP 型の返り値を持つ。
191 成功した場合は 0 を返し、割り当てエラーが発生した場合は
193 .\"O .SH "CONFORMING TO"
195 .\"O These functions are a GNU extension.
196 .\"O Handle with care.
197 これらの関数は GNU による拡張である。注意して使用すること。
206 main(int argc, char *argv[], char *envp[])
211 for (i = 0; envp[i] != NULL; i++)
212 e_len += strlen(envp[i]) + 1;
214 str = envz_entry(*envp, e_len, "HOME");
215 printf("%s\en", str);
216 str = envz_get(*envp, e_len, "HOME");
217 printf("%s\en", str);