2002-09-03 15:52:59 +04:00
|
|
|
/***************************************************************************
|
2004-10-06 11:50:18 +04:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 17:20:26 +03:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2006-01-09 16:17:14 +03:00
|
|
|
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2002-09-03 15:52:59 +04: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 11:50:18 +04:00
|
|
|
*
|
2001-01-03 12:29:33 +03: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 15:52:59 +04:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2001-01-03 12:29:33 +03:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 17:20:26 +03:00
|
|
|
*
|
2001-01-03 12:29:33 +03:00
|
|
|
* $Id$
|
2002-09-03 15:52:59 +04:00
|
|
|
***************************************************************************/
|
1999-12-29 17:20:26 +03:00
|
|
|
|
2001-11-12 13:19:36 +03:00
|
|
|
#include "setup.h"
|
|
|
|
|
1999-12-29 17:20:26 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2000-05-30 03:07:22 +04:00
|
|
|
#include <string.h>
|
1999-12-29 17:20:26 +03:00
|
|
|
|
2001-08-06 16:19:26 +04:00
|
|
|
#ifdef VMS
|
|
|
|
#include <unixlib.h>
|
|
|
|
#endif
|
|
|
|
|
2004-01-29 16:56:45 +03:00
|
|
|
#include <curl/curl.h>
|
2004-05-11 15:30:23 +04:00
|
|
|
#include "memory.h"
|
2004-01-29 16:56:45 +03:00
|
|
|
|
2000-10-09 15:12:34 +04:00
|
|
|
#include "memdebug.h"
|
|
|
|
|
2001-01-05 13:11:41 +03:00
|
|
|
static
|
2001-08-14 12:25:47 +04:00
|
|
|
char *GetEnv(const char *variable)
|
1999-12-29 17:20:26 +03:00
|
|
|
{
|
2004-11-02 13:12:22 +03:00
|
|
|
#ifdef _WIN32_WCE
|
|
|
|
return NULL;
|
|
|
|
#else
|
1999-12-29 17:20:26 +03:00
|
|
|
#ifdef WIN32
|
2000-05-30 03:07:22 +04:00
|
|
|
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
1999-12-29 17:20:26 +03:00
|
|
|
char *temp = getenv(variable);
|
|
|
|
env[0] = '\0';
|
2001-01-24 12:01:32 +03:00
|
|
|
if (temp != NULL)
|
|
|
|
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
2001-08-06 16:19:26 +04:00
|
|
|
#else
|
2004-10-06 11:50:18 +04:00
|
|
|
#ifdef VMS
|
2001-08-06 16:19:26 +04:00
|
|
|
char *env = getenv(variable);
|
|
|
|
if (env && strcmp("HOME",variable) == 0) {
|
2004-10-06 11:50:18 +04:00
|
|
|
env = decc$translate_vms(env);
|
2001-08-06 16:19:26 +04:00
|
|
|
}
|
1999-12-29 17:20:26 +03:00
|
|
|
#else
|
|
|
|
/* no length control */
|
|
|
|
char *env = getenv(variable);
|
2001-08-06 16:19:26 +04:00
|
|
|
#endif
|
1999-12-29 17:20:26 +03:00
|
|
|
#endif
|
2001-01-24 12:01:32 +03:00
|
|
|
return (env && env[0])?strdup(env):NULL;
|
2004-11-02 13:12:22 +03:00
|
|
|
#endif
|
1999-12-29 17:20:26 +03:00
|
|
|
}
|
|
|
|
|
2001-08-14 12:25:47 +04:00
|
|
|
char *curl_getenv(const char *v)
|
1999-12-29 17:20:26 +03:00
|
|
|
{
|
|
|
|
return GetEnv(v);
|
|
|
|
}
|