1999-12-29 09:20:26 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2001-01-03 04:29:33 -05:00
|
|
|
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 09:20:26 -05:00
|
|
|
*
|
2001-01-03 04:29:33 -05:00
|
|
|
* In order to be useful for every potential user, curl and libcurl are
|
|
|
|
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
1999-12-29 09:20:26 -05:00
|
|
|
*
|
2001-01-03 04:29:33 -05: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
|
|
|
|
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
|
|
|
* licenses. You may pick one of these licenses.
|
1999-12-29 09:20:26 -05:00
|
|
|
*
|
2001-01-03 04:29:33 -05:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 09:20:26 -05:00
|
|
|
*
|
2001-01-03 04:29:33 -05:00
|
|
|
* $Id$
|
|
|
|
*****************************************************************************/
|
1999-12-29 09:20:26 -05:00
|
|
|
|
2001-11-12 05:19:36 -05:00
|
|
|
#include "setup.h"
|
|
|
|
|
1999-12-29 09:20:26 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2000-05-29 19:07:22 -04:00
|
|
|
#include <string.h>
|
1999-12-29 09:20:26 -05:00
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2001-08-06 08:19:26 -04:00
|
|
|
#ifdef VMS
|
|
|
|
#include <unixlib.h>
|
|
|
|
#endif
|
|
|
|
|
2000-10-09 07:12:34 -04:00
|
|
|
#ifdef MALLOCDEBUG
|
|
|
|
#include "memdebug.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-05 05:11:41 -05:00
|
|
|
static
|
2001-08-14 04:25:47 -04:00
|
|
|
char *GetEnv(const char *variable)
|
1999-12-29 09:20:26 -05:00
|
|
|
{
|
|
|
|
#ifdef WIN32
|
|
|
|
/* This shit requires windows.h (HUGE) to be included */
|
2000-05-29 19:07:22 -04:00
|
|
|
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
|
1999-12-29 09:20:26 -05:00
|
|
|
char *temp = getenv(variable);
|
|
|
|
env[0] = '\0';
|
2001-01-24 04:01:32 -05:00
|
|
|
if (temp != NULL)
|
|
|
|
ExpandEnvironmentStrings(temp, env, sizeof(env));
|
2001-08-06 08:19:26 -04:00
|
|
|
#else
|
|
|
|
#ifdef VMS
|
|
|
|
char *env = getenv(variable);
|
|
|
|
if (env && strcmp("HOME",variable) == 0) {
|
|
|
|
env = decc$translate_vms(env);
|
|
|
|
}
|
|
|
|
/* printf ("Getenv: %s=%s\n",variable,env); */
|
1999-12-29 09:20:26 -05:00
|
|
|
#else
|
|
|
|
/* no length control */
|
|
|
|
char *env = getenv(variable);
|
2001-08-06 08:19:26 -04:00
|
|
|
#endif
|
1999-12-29 09:20:26 -05:00
|
|
|
#endif
|
2001-01-24 04:01:32 -05:00
|
|
|
return (env && env[0])?strdup(env):NULL;
|
1999-12-29 09:20:26 -05:00
|
|
|
}
|
|
|
|
|
2001-08-14 04:25:47 -04:00
|
|
|
char *curl_getenv(const char *v)
|
1999-12-29 09:20:26 -05:00
|
|
|
{
|
|
|
|
return GetEnv(v);
|
|
|
|
}
|
2001-09-07 00:01:32 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* local variables:
|
|
|
|
* eval: (load-file "../curl-mode.el")
|
|
|
|
* end:
|
2001-10-11 05:32:19 -04:00
|
|
|
* vim600: fdm=marker
|
|
|
|
* vim: et sw=2 ts=2 sts=2 tw=78
|
2001-09-07 00:01:32 -04:00
|
|
|
*/
|