Import upstream 2.3.14
[packages/xinetd.git] / libs / src / misc / m_env.h
1 /*
2  * (c) Copyright 1992 by Panagiotis Tsirigotis
3  * All rights reserved.  The file named COPYRIGHT specifies the terms 
4  * and conditions for redistribution.
5  */
6
7 #ifndef __M_ENV_H
8 #define __M_ENV_H
9
10 /*
11  * $Id: m_env.h,v 1.2 2003/03/09 19:27:08 steveg Exp $
12  */
13
14 struct __env
15 {
16    unsigned max_vars ;
17    unsigned n_vars ;
18    char **vars ;
19 } ;
20
21 typedef struct __env *env_h ;
22
23 #define ENV_NULL                  ((env_h)0)
24
25 /*
26  * Return values
27  */
28 #define ENV_ERR                   (-1)
29 #define ENV_OK                    0
30
31 /*
32  * Error codes
33  */
34 #define ENV_ENOMEM                1
35 #define ENV_EBADVAR               2
36 #define ENV_EBADSTRING            3
37
38
39 env_h env_create ( const env_h ) ;
40 void env_destroy ( env_h ) ;
41 env_h env_make ( char **env_strings ) ;
42 int env_addvar ( env_h, env_h from_env, char *var ) ;
43 int env_addstr ( env_h, char *str ) ;
44 char *env_lookup ( env_h, const char *var ) ;
45
46 #define env_getvars( env )            (env)->vars
47
48 extern int env_errno ;
49
50 #endif   /* __M_ENV_H */
51