syncing with local edit
[platform/upstream/curl.git] / lib / getenv.c
1 /*****************************************************************************
2  *                                  _   _ ____  _     
3  *  Project                     ___| | | |  _ \| |    
4  *                             / __| | | | |_) | |    
5  *                            | (__| |_| |  _ <| |___ 
6  *                             \___|\___/|_| \_\_____|
7  *
8  *  The contents of this file are subject to the Mozilla Public License
9  *  Version 1.0 (the "License"); you may not use this file except in
10  *  compliance with the License. You may obtain a copy of the License at
11  *  http://www.mozilla.org/MPL/
12  *
13  *  Software distributed under the License is distributed on an "AS IS"
14  *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
15  *  License for the specific language governing rights and limitations
16  *  under the License.
17  *
18  *  The Original Code is Curl.
19  *
20  *  The Initial Developer of the Original Code is Daniel Stenberg.
21  *
22  *  Portions created by the Initial Developer are Copyright (C) 1998.
23  *  All Rights Reserved.
24  *
25  *  Contributor(s):
26  *   Rafael Sagula <sagula@inf.ufrgs.br>
27  *   Sampo Kellomaki <sampo@iki.fi>
28  *   Linas Vepstas <linas@linas.org>
29  *   Bjorn Reese <breese@imada.ou.dk>
30  *   Johan Anderson <johan@homemail.com>
31  *   Kjell Ericson <Kjell.Ericson@haxx.nu>
32  *   Troy Engel <tengel@palladium.net>
33  *   Ryan Nelson <ryan@inch.com>
34  *   Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
35  *   Angus Mackay <amackay@gus.ml.org>
36  *
37  * ------------------------------------------------------------
38  * Main author:
39  * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
40  *
41  *      http://curl.haxx.nu
42  *
43  * $Source$
44  * $Revision$
45  * $Date$
46  * $Author$
47  * $State$
48  * $Locker$
49  *
50  * ------------------------------------------------------------
51  * $Log$
52  * Revision 1.2  2000-01-10 23:36:14  bagder
53  * syncing with local edit
54  *
55  * Revision 1.4  1999/09/06 06:59:40  dast
56  * Changed email info
57  *
58  * Revision 1.3  1999/08/13 07:34:48  dast
59  * Changed the URL in the header
60  *
61  * Revision 1.2  1999/03/13 00:56:09  dast
62  * Big changes done due to url.c being split up in X smaller files and that
63  * the lib is now more stand-alone.
64  *
65  * Revision 1.1.1.1  1999/03/11 22:23:34  dast
66  * Imported sources
67  *
68  ****************************************************************************/
69
70 #include <stdio.h>
71 #include <stdlib.h>
72
73 #ifdef WIN32
74 #include <windows.h>
75 #endif
76
77 char *GetEnv(char *variable)
78 {
79 #ifdef WIN32
80   /* This shit requires windows.h (HUGE) to be included */
81   static char env[MAX_PATH]; /* MAX_PATH is from windef.h */
82   char *temp = getenv(variable);
83   env[0] = '\0';
84   ExpandEnvironmentStrings(temp, env, sizeof(env));
85 #else
86   /* no length control */
87   char *env = getenv(variable);
88 #endif
89   return env;
90 }
91
92 char *curl_GetEnv(char *v)
93 {
94   return GetEnv(v);
95 }