Tue Jul 2 23:45:14 1996 Ulrich Drepper <drepper@cygnus.com>
[glibc/history.git] / string / envz.h
blobfd8865711dbc51191d2b064af985b935e48266ce
1 /* Routines for dealing with '\0' separated environment vectors
3 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
5 Written by Miles Bader <miles@gnu.ai.mit.edu>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2, or (at
10 your option) any later version.
12 This program is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #ifndef __ENVZ_H__
22 #define __ENVZ_H__
24 #include <errno.h>
26 /* Envz's are argz's too, and should be created etc., using the same
27 routines. */
28 #include <argz.h>
30 /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none. */
31 char *envz_entry __P ((__const char *__envz, size_t __envz_len,
32 __const char *__name));
34 /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
35 if there is none. */
36 char *envz_get __P ((__const char *__envz, size_t __envz_len,
37 __const char *__name));
39 /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN. If an entry
40 with the same name already exists in ENVZ, it is removed. If VALUE is
41 NULL, then the new entry will a special null one, for which envz_get will
42 return NULL, although envz_entry will still return an entry; this is handy
43 because when merging with another envz, the null entry can override an
44 entry in the other one. Null entries can be removed with envz_strip (). */
45 error_t envz_add __P ((char **__envz, size_t *__envz_len,
46 __const char *__name, __const char *__value));
48 /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If
49 OVERRIDE is true, then values in ENVZ2 will supercede those with the same
50 name in ENV, otherwise not. */
51 error_t envz_merge __P ((char **__envz, size_t *__envz_len,
52 __const char *__envz2, size_t __envz2_len,
53 int __override));
55 /* Remove null entries. */
56 void envz_strip __P ((char **__envz, size_t *__envz_len));
58 #endif /* __ENVZ_H__ */