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 ARGZ_ADD 3 2007-05-18 "" "Linux Programmer's Manual"
13 .\"O argz_add, argz_add_sep, argz_append, argz_count, argz_create,
14 .\"O argz_create_sep, argz_delete, argz_extract, argz_insert,
15 .\"O argz_next, argz_replace, argz_stringify \- functions to handle an argz list
16 argz_add, argz_add_sep, argz_append, argz_count, argz_create,
17 argz_create_sep, argz_delete, argz_extract, argz_insert,
18 argz_next, argz_replace, argz_stringify \- argz リストを操作するための関数群
22 .B "#include <argz.h>"
24 .BI "error_t argz_add(char **" argz ", size_t *" argz_len \
25 ", const char *" str );
27 .BI "error_t argz_add_sep(char **" argz ", size_t *" argz_len ,
29 .BI "const char *" str ", int " delim );
31 .BI "error_t argz_append(char **" argz ", size_t *" argz_len ,
33 .BI "const char *" buf ", size_t " buf_len );
35 .BI "size_t argz_count(const char *" argz ", size_t " argz_len );
37 .BI "error_t argz_create(char * const " argv "[], char **" argz ,
39 .BI "size_t *" argz_len );
41 .BI "error_t argz_create_sep(const char *" str ", int " sep ", char **" argz ,
43 .BI "size_t *" argz_len );
45 .BI "error_t argz_delete(char **" argz ", size_t *" argz_len ", char *" entry );
47 .BI "void argz_extract(char *" argz ", size_t " argz_len ", char **" argv );
49 .BI "error_t argz_insert(char **" argz ", size_t *" argz_len ", char *" before ,
51 .BI "const char *" entry );
53 .BI "char *argz_next(char *" argz ", size_t " argz_len ", const char *" entry );
55 .BI "error_t argz_replace(char **" argz ", size_t *" argz_len \
56 ", const char *" str ,
58 .BI "const char *" with ", unsigned int *" replace_count );
60 .BI "void argz_stringify(char *" argz ", size_t " len ", int " sep );
64 .\"O These functions are glibc-specific.
67 .\"O An argz vector is a pointer to a character buffer together with a length.
68 .\"O The intended interpretation of the character buffer is an array
69 .\"O of strings, where the strings are separated by null bytes (\\(aq\\0\\(aq).
70 .\"O If the length is nonzero, the last byte of the buffer must be a null byte.
71 argz vector は長さ情報付きの文字バッファへのポインタである。
72 文字バッファでは、複数の文字列が NULL バイト (\\(aq\\0\\(aq) で区切られており、
73 文字列の配列として解釈されるようになっている。
74 長さが 0 でない場合、バッファの最後のバイトは NULL バイトでなければならない。
76 .\"O These functions are for handling argz vectors.
77 .\"O The pair (NULL,0) is an argz vector, and, conversely,
78 .\"O argz vectors of length 0 must have NULL pointer.
79 .\"O Allocation of nonempty argz vectors is done using
83 .\"O can be used to dispose of them again.
84 これらの関数は argz vector を操作するためのものである。
85 ペア (NULL,0) は argz vector であり、逆に言えば
86 長さ 0 の argz vectorは NULL ポインタを持たなければならない。
87 空でない argz vector の割り当ては
89 を使って行われる。したがって、argz vector を解放するのに
96 .\"O at the end of the array
113 .\"O .BR argz_add_sep ()
114 .\"O is similar, but splits the string
116 .\"O into substrings separated by the delimiter
118 .\"O For example, one might use this on a UNIX search path with
119 .\"O delimiter \\(aq:\\(aq.
126 例えば、区切り文字 \\(aq:\\(aq を指定して、UNIX サーチ・パスに対して
129 .\"O .BR argz_append ()
130 .\"O appends the argz vector
131 .\"O .RI ( buf ,\ buf_len )
133 .\"O .RI (* argz ,\ *argz_len )
140 .\"O will be increased by
144 .RI ( buf ,\ buf_len )
146 .RI (* argz ,\ *argz_len )
158 .\"O .BR argz_count ()
159 .\"O counts the number of strings, that is,
160 .\"O the number of null bytes (\\(aq\\0\\(aq), in
161 .\"O .RI ( argz ,\ argz_len ).
164 .RI ( argz ,\ argz_len )
165 内の文字列の数を数える。実際には NULL バイト (\\(aq\\0\\(aq) の数を数えている。
167 .\"O .BR argz_create ()
168 .\"O converts a UNIX-style argument vector
171 .\"O .IR "(char *) 0" ,
172 .\"O into an argz vector
173 .\"O .RI ( *argz ,\ *argz_len ).
180 .RI ( *argz ,\ *argz_len )
183 .\"O .BR argz_create_sep ()
184 .\"O converts the null-terminated string
186 .\"O into an argz vector
187 .\"O .RI (* argz ,\ *argz_len )
188 .\"O by breaking it up at every occurrence of the separator
190 .BR argz_create_sep ()
195 が現れる毎に分割しながら、argz vector
196 .RI (* argz ,\ *argz_len )
199 .\"O .BR argz_delete ()
200 .\"O removes the substring pointed to by
202 .\"O from the argz vector
203 .\"O .RI ( *argz ,\ *argz_len )
211 で指し示された文字列を argz vector
212 .RI ( *argz ,\ *argz_len )
219 .\"O .BR argz_extract ()
220 .\"O is the opposite of
221 .\"O .BR argz_create ().
222 .\"O It takes the argz vector
223 .\"O .RI ( argz ,\ argz_len )
224 .\"O and fills the array starting at
226 .\"O with pointers to the substrings, and a final NULL,
227 .\"O making a UNIX-style argv vector.
230 .\"O must have room for
231 .\"O .IR argz_count ( argz , argz_len ") + 1"
236 の反対の操作を行う。argz vector
237 .RI ( argz ,\ argz_len )
240 から始まる配列をサブ文字列へのポインタで埋めていき、
241 一番最後に NULL を入れて、UNIX 流の argv ベクトルを作成する。
245 .IR argz_count ( argz , argz_len ") + 1"
246 個のポインタを収容できる空間を持っていなければならない。
248 .\"O .BR argz_insert ()
249 .\"O is the opposite of
250 .\"O .BR argz_delete ().
251 .\"O It inserts the argument
255 .\"O into the argz vector
256 .\"O .RI ( *argz ,\ *argz_len )
265 .\"O will inserted at the end.
269 の反対の操作を行う。argz vector
270 .RI ( *argz ,\ *argz_len )
285 .\"O .BR argz_next ()
286 .\"O is a function to step trough the argz vector.
289 .\"O is NULL, the first entry is returned.
290 .\"O Otherwise, the entry
291 .\"O following is returned.
292 .\"O It returns NULL if there is no following entry.
294 は argz vector を順番に調べるための関数である。
296 が NULL の場合、最初のエントリを返す。
298 次のエントリがない場合、NULL を返す。
300 .\"O .BR argz_replace ()
301 .\"O replaces each occurrence of
305 .\"O reallocating argz as necessary.
307 .\"O .I replace_count
309 .\"O .I *replace_count
310 .\"O will be incremented by the number of replacements.
316 で置き換える (必要に応じて argz の再割り当てを行う)。
322 .\"O .BR argz_stringify ()
323 .\"O is the opposite of
324 .\"O .BR argz_create_sep ().
325 .\"O It transforms the argz vector into a normal string by replacing
326 .\"O all null bytes (\\(aq\\0\\(aq) except the last by
328 .BR argz_stringify ()
330 .BR argz_create_sep ()
332 末尾の NULL バイト以外の全ての NULL バイト (\\(aq\\0\\(aq) を
335 argz vector を通常の文字列に変換する。
336 .\"O .SH "RETURN VALUE"
338 .\"O All argz functions that do memory allocation have a return type of
339 .\"O \fIerror_t\fP, and return 0 for success, and \fBENOMEM\fP
340 .\"O if an allocation error occurs.
341 メモリ割り当てを行う argz 関数群はすべて \fIerror_t\fP 型の返り値を持つ。
342 成功した場合は 0 を返し、割り当てエラーが発生した場合は
344 .\"O .SH CONFORMING TO
346 .\"O These functions are a GNU extension.
347 .\"O Handle with care.
348 これらの関数は GNU による拡張である。注意して使用すること。
351 .\"O Argz vectors without a terminating null byte may lead to
352 .\"O Segmentation Faults.
353 NULL バイトで終端されていない argz vector を使用した場合、
354 segmentation fault を起こすかもしれない。