00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "setup.h"
00025
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <string.h>
00029
00030 #ifdef VMS
00031 #include <unixlib.h>
00032 #endif
00033
00034 #include <curl/curl.h>
00035 #include "memory.h"
00036
00037 #include "memdebug.h"
00038
00039 static
00040 char *GetEnv(const char *variable)
00041 {
00042 #ifdef _WIN32_WCE
00043 return NULL;
00044 #else
00045 #ifdef WIN32
00046 char env[MAX_PATH];
00047 char *temp = getenv(variable);
00048 env[0] = '\0';
00049 if (temp != NULL)
00050 ExpandEnvironmentStrings(temp, env, sizeof(env));
00051 #else
00052 #ifdef VMS
00053 char *env = getenv(variable);
00054 if (env && strcmp("HOME",variable) == 0) {
00055 env = decc$translate_vms(env);
00056 }
00057 #else
00058
00059 char *env = getenv(variable);
00060 #endif
00061 #endif
00062 return (env && env[0])?strdup(env):NULL;
00063 #endif
00064 }
00065
00066 char *curl_getenv(const char *v)
00067 {
00068 return GetEnv(v);
00069 }