xref: /plan9/sys/src/cmd/gs/src/gpgetenv.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1998 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gpgetenv.h,v 1.5 2002/06/16 06:59:02 lpd Exp $ */
18 /* Interface to platform-specific getenv routine */
19 
20 #ifndef gpgetenv_INCLUDED
21 #  define gpgetenv_INCLUDED
22 
23 /*
24  * Get a value from the environment (getenv).
25  *
26  * If the key is missing, set *ptr = 0 (if *plen > 0), set *plen = 1,
27  * and return 1.
28  *
29  * If the key is present and the length len of the value (not counting
30  * the terminating \0) is less than *plen, copy the value to ptr, set
31  * *plen = len + 1, and return 0.
32  *
33  * If the key is present and len >= *plen, set *plen = len + 1,
34  * don't store anything at ptr, and return -1.
35  *
36  * Note that *plen is the size of the buffer, not the length of the string:
37  * because of the terminating \0, the maximum string length is 1 less than
38  * the size of the buffer.
39  */
40 int gp_getenv(const char *key, char *ptr, int *plen);
41 
42 #endif /* gpgetenv_INCLUDED */
43