mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-09 00:15:14 +00:00
Fixes ENVIRON$() in *nix systems when passing a string.
This commit is contained in:
parent
ae887507c2
commit
90461eb226
|
@ -21355,15 +21355,19 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
|
||||||
|
|
||||||
qbs *func_environ(qbs *name)
|
qbs *func_environ(qbs *name)
|
||||||
{
|
{
|
||||||
|
static char *cp;
|
||||||
|
static qbs *tqbs;
|
||||||
|
static int32 bytes;
|
||||||
|
#ifdef QB64_WINDOWS
|
||||||
static char *withNull;
|
static char *withNull;
|
||||||
withNull=(char*)malloc(name->len+1);
|
withNull=(char*)malloc(name->len+1);
|
||||||
withNull[name->len]=0;//add NULL terminator
|
withNull[name->len]=0;//add NULL terminator
|
||||||
memcpy(withNull,name->chr,name->len);
|
memcpy(withNull,name->chr,name->len);
|
||||||
|
|
||||||
static char *cp;
|
|
||||||
static qbs *tqbs;
|
|
||||||
static int32 bytes;
|
|
||||||
cp=getenv(withNull);
|
cp=getenv(withNull);
|
||||||
|
#else
|
||||||
|
cp=getenv((char*)name->chr);
|
||||||
|
#endif
|
||||||
if (cp){
|
if (cp){
|
||||||
bytes=strlen(cp);
|
bytes=strlen(cp);
|
||||||
tqbs=qbs_new(bytes,1);
|
tqbs=qbs_new(bytes,1);
|
||||||
|
|
Loading…
Reference in a new issue