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 ENVZ_ADD 3 2007-05-18 "" "Linux Programmer's Manual"
12 envz_add, envz_entry, envz_get, envz_merge,
13 envz_remove, envz_strip \- environment string support
16 .B "#include <envz.h>"
18 .BI "error_t envz_add(char **" envz ", size_t *" envz_len ,
19 .BI " const char *" name ", const char *" value );
21 .BI "char *envz_entry(const char *" envz ", size_t *" envz_len \
22 ", const char *" name );
24 .BI "char *envz_get(const char *" envz ", size_t *" envz_len \
25 ", const char *" name );
27 .BI "error_t envz_merge(char **" envz ", size_t *" envz_len ,
28 .BI " const char *" envz2 ", size_t " envz2_len \
31 .BI "void envz_remove(char **" envz ", size_t *" envz_len \
32 ", const char *" name );
34 .BI "void envz_strip(char **" envz ", size_t *" envz_len );
37 These functions are glibc-specific.
39 An argz vector is a pointer to a character buffer together with a length,
42 An envz vector is a special argz vector, namely one where the strings
43 have the form "name=value".
44 Everything after the first \(aq=\(aq is considered
46 If there is no \(aq=\(aq, the value is taken to be NULL.
47 (While the value in case of a trailing \(aq=\(aq is the empty string "".)
49 These functions are for handling envz vectors.
53 .RI \&" name = value \&"
60 is NULL) to the envz vector
61 .RI ( *envz ,\ *envz_len )
66 If an entry with the same
68 existed, it is removed.
74 .RI ( envz ,\ envz_len )
75 and returns the entry if found, or NULL if not.
81 .RI ( envz ,\ envz_len )
82 and returns the value if found, or NULL if not.
83 (Note that the value can also be NULL, namely when there is
86 without \(aq=\(aq sign.)
97 is true, then values in
99 will supersede those with the same name in
104 removes the entry for
107 .RI ( *envz ,\ *envz_len )
111 removes all entries with value NULL.
113 All envz functions that do memory allocation have a return type of
115 and return 0 for success, and
117 if an allocation error occurs.
119 These functions are a GNU extension.
128 main(int argc, char *argv[], char *envp[])
133 for (i = 0; envp[i] != NULL; i++)
134 e_len += strlen(envp[i]) + 1;
136 str = envz_entry(*envp, e_len, "HOME");
137 printf("%s\en", str);
138 str = envz_get(*envp, e_len, "HOME");
139 printf("%s\en", str);
146 This page is part of release 3.67 of the Linux
149 A description of the project,
150 information about reporting bugs,
151 and the latest version of this page,
153 \%http://www.kernel.org/doc/man\-pages/.