1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-03 12:21:20 +00:00

Fixes ENVIRON$() in *nix systems when passing a string.

This commit is contained in:
Fellippe Heitor 2021-07-17 01:04:27 -03:00
parent ae887507c2
commit 90461eb226

View file

@ -21355,15 +21355,19 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
qbs *func_environ(qbs *name)
{
static char *withNull;
withNull=(char*)malloc(name->len+1);
withNull[name->len]=0;//add NULL terminator
memcpy(withNull,name->chr,name->len);
static char *cp;
static qbs *tqbs;
static int32 bytes;
cp=getenv(withNull);
#ifdef QB64_WINDOWS
static char *withNull;
withNull=(char*)malloc(name->len+1);
withNull[name->len]=0;//add NULL terminator
memcpy(withNull,name->chr,name->len);
cp=getenv(withNull);
#else
cp=getenv((char*)name->chr);
#endif
if (cp){
bytes=strlen(cp);
tqbs=qbs_new(bytes,1);