1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
7 .\" based on the description in glibc source and infopages
9 .\" Corrections and additions, aeb
10 .TH ARGZ_ADD 3 2017-09-15 "" "Linux Programmer's Manual"
12 argz_add, argz_add_sep, argz_append, argz_count, argz_create,
13 argz_create_sep, argz_delete, argz_extract, argz_insert,
14 argz_next, argz_replace, argz_stringify \- functions to handle an argz list
17 .B "#include <argz.h>"
19 .BI "error_t argz_add(char **" argz ", size_t *" argz_len \
20 ", const char *" str );
22 .BI "error_t argz_add_sep(char **" argz ", size_t *" argz_len ,
23 .BI " const char *" str ", int " delim );
25 .BI "error_t argz_append(char **" argz ", size_t *" argz_len ,
26 .BI " const char *" buf ", size_t " buf_len );
28 .BI "size_t argz_count(const char *" argz ", size_t " argz_len );
30 .BI "error_t argz_create(char * const " argv "[], char **" argz ,
31 .BI " size_t *" argz_len );
33 .BI "error_t argz_create_sep(const char *" str ", int " sep ", char **" argz ,
34 .BI " size_t *" argz_len );
36 .BI "void argz_delete(char **" argz ", size_t *" argz_len ", char *" entry );
38 .BI "void argz_extract(const char *" argz ", size_t " argz_len ", char **" argv );
40 .BI "error_t argz_insert(char **" argz ", size_t *" argz_len ", char *" before ,
41 .BI " const char *" entry );
43 .BI "char *argz_next(const char *" argz ", size_t " argz_len ", const char *" entry );
45 .BI "error_t argz_replace(char **" argz ", size_t *" argz_len \
46 ", const char *" str ,
47 .BI " const char *" with ", unsigned int *" replace_count );
49 .BI "void argz_stringify(char *" argz ", size_t " len ", int " sep );
52 These functions are glibc-specific.
54 An argz vector is a pointer to a character buffer together with a length.
55 The intended interpretation of the character buffer is an array
56 of strings, where the strings are separated by null bytes (\(aq\\0\(aq).
57 If the length is nonzero, the last byte of the buffer must be a null byte.
59 These functions are for handling argz vectors.
60 The pair (NULL,0) is an argz vector, and, conversely,
61 argz vectors of length 0 must have null pointer.
62 Allocation of nonempty argz vectors is done using
66 can be used to dispose of them again.
71 at the end of the array
79 is similar, but splits the string
81 into substrings separated by the delimiter
83 For example, one might use this on a UNIX search path with
87 appends the argz vector
88 .RI ( buf ,\ buf_len )
90 .RI ( *argz ,\ *argz_len )
101 counts the number of strings, that is,
102 the number of null bytes (\(aq\\0\(aq), in
103 .RI ( argz ,\ argz_len ).
106 converts a UNIX-style argument vector
111 .RI ( *argz ,\ *argz_len ).
113 .BR argz_create_sep ()
114 converts the null-terminated string
117 .RI ( *argz ,\ *argz_len )
118 by breaking it up at every occurrence of the separator
122 removes the substring pointed to by
125 .RI ( *argz ,\ *argz_len )
134 It takes the argz vector
135 .RI ( argz ,\ argz_len )
136 and fills the array starting at
138 with pointers to the substrings, and a final NULL,
139 making a UNIX-style argv vector.
143 .IR argz_count ( argz ", " argz_len ") + 1"
149 It inserts the argument
154 .RI ( *argz ,\ *argz_len )
163 will inserted at the end.
166 is a function to step trough the argz vector.
169 is NULL, the first entry is returned.
171 following is returned.
172 It returns NULL if there is no following entry.
175 replaces each occurrence of
179 reallocating argz as necessary.
184 will be incremented by the number of replacements.
186 .BR argz_stringify ()
188 .BR argz_create_sep ().
189 It transforms the argz vector into a normal string by replacing
190 all null bytes (\(aq\\0\(aq) except the last by
193 All argz functions that do memory allocation have a return type of
195 and return 0 for success, and
197 if an allocation error occurs.
199 For an explanation of the terms used in this section, see
205 Interface Attribute Value
214 .BR argz_create_sep (),
223 .BR argz_stringify ()
224 T} Thread safety MT-Safe
228 These functions are a GNU extension.
231 Argz vectors without a terminating null byte may lead to