xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/envz.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /* Routines for dealing with '\0' separated environment vectors
2*53ee8cc1Swenshuai.xi    Copyright (C) 1995, 96, 98, 99, 2000 Free Software Foundation, Inc.
3*53ee8cc1Swenshuai.xi    This file is part of the GNU C Library.
4*53ee8cc1Swenshuai.xi 
5*53ee8cc1Swenshuai.xi    The GNU C Library is free software; you can redistribute it and/or
6*53ee8cc1Swenshuai.xi    modify it under the terms of the GNU Lesser General Public
7*53ee8cc1Swenshuai.xi    License as published by the Free Software Foundation; either
8*53ee8cc1Swenshuai.xi    version 2.1 of the License, or (at your option) any later version.
9*53ee8cc1Swenshuai.xi 
10*53ee8cc1Swenshuai.xi    The GNU C Library is distributed in the hope that it will be useful,
11*53ee8cc1Swenshuai.xi    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*53ee8cc1Swenshuai.xi    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*53ee8cc1Swenshuai.xi    Lesser General Public License for more details.
14*53ee8cc1Swenshuai.xi 
15*53ee8cc1Swenshuai.xi    You should have received a copy of the GNU Lesser General Public
16*53ee8cc1Swenshuai.xi    License along with the GNU C Library; if not, write to the Free
17*53ee8cc1Swenshuai.xi    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18*53ee8cc1Swenshuai.xi    02111-1307 USA.  */
19*53ee8cc1Swenshuai.xi 
20*53ee8cc1Swenshuai.xi #ifndef _ENVZ_H
21*53ee8cc1Swenshuai.xi #define _ENVZ_H	1
22*53ee8cc1Swenshuai.xi 
23*53ee8cc1Swenshuai.xi #include <features.h>
24*53ee8cc1Swenshuai.xi 
25*53ee8cc1Swenshuai.xi #include <errno.h>
26*53ee8cc1Swenshuai.xi 
27*53ee8cc1Swenshuai.xi /* Envz's are argz's too, and should be created etc., using the same
28*53ee8cc1Swenshuai.xi    routines.  */
29*53ee8cc1Swenshuai.xi #include <argz.h>
30*53ee8cc1Swenshuai.xi 
31*53ee8cc1Swenshuai.xi __BEGIN_DECLS
32*53ee8cc1Swenshuai.xi 
33*53ee8cc1Swenshuai.xi /* Returns a pointer to the entry in ENVZ for NAME, or 0 if there is none.  */
34*53ee8cc1Swenshuai.xi extern char *envz_entry (__const char *__restrict __envz, size_t __envz_len,
35*53ee8cc1Swenshuai.xi 			 __const char *__restrict __name)
36*53ee8cc1Swenshuai.xi      __THROW __attribute_pure__;
37*53ee8cc1Swenshuai.xi 
38*53ee8cc1Swenshuai.xi /* Returns a pointer to the value portion of the entry in ENVZ for NAME, or 0
39*53ee8cc1Swenshuai.xi    if there is none.  */
40*53ee8cc1Swenshuai.xi extern char *envz_get (__const char *__restrict __envz, size_t __envz_len,
41*53ee8cc1Swenshuai.xi 		       __const char *__restrict __name)
42*53ee8cc1Swenshuai.xi      __THROW __attribute_pure__;
43*53ee8cc1Swenshuai.xi 
44*53ee8cc1Swenshuai.xi /* Adds an entry for NAME with value VALUE to ENVZ & ENVZ_LEN.  If an entry
45*53ee8cc1Swenshuai.xi    with the same name already exists in ENVZ, it is removed.  If VALUE is
46*53ee8cc1Swenshuai.xi    NULL, then the new entry will a special null one, for which envz_get will
47*53ee8cc1Swenshuai.xi    return NULL, although envz_entry will still return an entry; this is handy
48*53ee8cc1Swenshuai.xi    because when merging with another envz, the null entry can override an
49*53ee8cc1Swenshuai.xi    entry in the other one.  Null entries can be removed with envz_strip ().  */
50*53ee8cc1Swenshuai.xi extern error_t envz_add (char **__restrict __envz,
51*53ee8cc1Swenshuai.xi 			 size_t *__restrict __envz_len,
52*53ee8cc1Swenshuai.xi 			 __const char *__restrict __name,
53*53ee8cc1Swenshuai.xi 			 __const char *__restrict __value) __THROW;
54*53ee8cc1Swenshuai.xi 
55*53ee8cc1Swenshuai.xi /* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add().  If
56*53ee8cc1Swenshuai.xi    OVERRIDE is true, then values in ENVZ2 will supersede those with the same
57*53ee8cc1Swenshuai.xi    name in ENV, otherwise not.  */
58*53ee8cc1Swenshuai.xi extern error_t envz_merge (char **__restrict __envz,
59*53ee8cc1Swenshuai.xi 			   size_t *__restrict __envz_len,
60*53ee8cc1Swenshuai.xi 			   __const char *__restrict __envz2,
61*53ee8cc1Swenshuai.xi 			   size_t __envz2_len, int __override) __THROW;
62*53ee8cc1Swenshuai.xi 
63*53ee8cc1Swenshuai.xi /* Remove the entry for NAME from ENVZ & ENVZ_LEN, if any.  */
64*53ee8cc1Swenshuai.xi extern void envz_remove (char **__restrict __envz,
65*53ee8cc1Swenshuai.xi 			 size_t *__restrict __envz_len,
66*53ee8cc1Swenshuai.xi 			 __const char *__restrict __name) __THROW;
67*53ee8cc1Swenshuai.xi 
68*53ee8cc1Swenshuai.xi /* Remove null entries.  */
69*53ee8cc1Swenshuai.xi extern void envz_strip (char **__restrict __envz,
70*53ee8cc1Swenshuai.xi 			size_t *__restrict __envz_len) __THROW;
71*53ee8cc1Swenshuai.xi 
72*53ee8cc1Swenshuai.xi __END_DECLS
73*53ee8cc1Swenshuai.xi 
74*53ee8cc1Swenshuai.xi #endif /* envz.h */
75