2002-09-03 13:52:59 +02:00
|
|
|
/***************************************************************************
|
2004-10-06 09:50:18 +02:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 15:20:26 +01:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2012-06-15 18:05:11 +02:00
|
|
|
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 15:20:26 +01:00
|
|
|
*
|
2002-09-03 13:52:59 +02:00
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
|
|
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
2004-10-06 09:50:18 +02:00
|
|
|
*
|
2001-01-03 10:29:33 +01:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
2002-09-03 13:52:59 +02:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 15:20:26 +01:00
|
|
|
*
|
2001-01-03 10:29:33 +01:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 15:20:26 +01:00
|
|
|
*
|
2002-09-03 13:52:59 +02:00
|
|
|
***************************************************************************/
|
1999-12-29 15:20:26 +01:00
|
|
|
|
2013-01-06 19:06:49 +01:00
|
|
|
#include "curl_setup.h"
|
2001-11-12 11:19:36 +01:00
|
|
|
|
2004-01-29 14:56:45 +01:00
|
|
|
#include <curl/curl.h>
|
2009-04-21 13:46:16 +02:00
|
|
|
#include "curl_memory.h"
|
2004-01-29 14:56:45 +01:00
|
|
|
|
2013-01-04 02:50:28 +01:00
|
|
|
#include "memdebug.h"
|
2000-10-09 13:12:34 +02:00
|
|
|
|
2001-01-05 11:11:41 +01:00
|
|
|
static
|
2001-08-14 10:25:47 +02:00
|
|
|
char *GetEnv(const char *variable)
|
1999-12-29 15:20:26 +01:00
|
|
|
{
|
2004-11-02 11:12:22 +01:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
return NULL;
|
|
|
|
#else
|
1999-12-29 15:20:26 +01:00
|
|
|
#ifdef WIN32
|
2000-05-30 01:07:22 +02:00
|
|
|
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
1999-12-29 15:20:26 +01:00
|
|
|
char *temp = getenv(variable);
|
|
|
|
env[0] = '\0';
|
2007-11-07 10:21:35 +01:00
|
|
|
if(temp != NULL)
|
2012-06-15 18:05:11 +02:00
|
|
|
ExpandEnvironmentStringsA(temp, env, sizeof(env));
|
2007-09-27 02:58:41 +02:00
|
|
|
return (env[0] != '\0')?strdup(env):NULL;
|
2001-08-06 14:19:26 +02:00
|
|
|
#else
|
1999-12-29 15:20:26 +01:00
|
|
|
char *env = getenv(variable);
|
2007-09-27 20:39:10 +02:00
|
|
|
return (env && env[0])?strdup(env):NULL;
|
1999-12-29 15:20:26 +01:00
|
|
|
#endif
|
2004-11-02 11:12:22 +01:00
|
|
|
#endif
|
1999-12-29 15:20:26 +01:00
|
|
|
}
|
|
|
|
|
2001-08-14 10:25:47 +02:00
|
|
|
char *curl_getenv(const char *v)
|
1999-12-29 15:20:26 +01:00
|
|
|
{
|
|
|
|
return GetEnv(v);
|
|
|
|
}
|