1 /*---------------------------------------------------------------------------*
2   Project:     Cafe
3   File:        env.h
4   Description: Library for reading host environment variables
5 
6   Copyright (C) 2011 Nintendo.  All rights reserved.
7 
8   These coded instructions, statements, and computer programs contain
9   proprietary information of Nintendo of America Inc. and/or Nintendo
10   Company Ltd., and are protected by Federal copyright law.  They may
11   not be disclosed to third parties or copied or duplicated in any form,
12   in whole or in part, without the prior written consent of Nintendo.
13 
14   *---------------------------------------------------------------------------*/
15 
16 #ifndef __ENV_INTERFACE_H__
17 #define __ENV_INTERFACE_H__
18 
19 #include <types.h>
20 #include <cafe/os.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif // __cplusplus
25 
26 // Retrieves null terminated value of the environment variable "key"
27 // If "key" does not exist, this will return an empty null temrinated string.
28 // Regardless of the size of the receiving buffer or length of the variable's
29 // value, the returned string is always null terminated.
30 //
31 // Arguments:
32 // key - name of the enfironment variable, null terminated
33 // value_buf - buffer to store variable's value
34 // value_buf_size - length of the buffer
35 //
36 // Returns:
37 // 0  - on success
38 // negative number - on failure
39 //
40 // Example:
41 // char buf[128];
42 // rv = ENVGetEnvironmentVariable("GHSTOOL", buf, sizeof(buf));
43 // if (rv == 0) OSReport("envvar value is %s\n", buf);
44 //
45 //
46 
47 #define MAX_ENV_VALUE_SIZE  256
48 
49 int ENVGetEnvironmentVariable(const char *key, char *value_buf, u32 value_buf_size);
50 
51 #ifdef __cplusplus
52 }
53 #endif // __cplusplus
54 
55 #endif // __ENV_INTERFACE_H__
56