1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 00:40:26 +00:00

Fixes ENVIRON$() to automatically add CHR$(0) to strings passed.

Closes #79
This commit is contained in:
FellippeHeitor 2020-10-18 01:14:25 -03:00
parent 4472c12a73
commit 1d07a3c802

View file

@ -21311,10 +21311,15 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
qbs *func_environ(qbs *name) 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 char *cp;
static qbs *tqbs; static qbs *tqbs;
static int32 bytes; static int32 bytes;
cp=getenv((char*)name->chr); cp=getenv(withNull);
if (cp){ if (cp){
bytes=strlen(cp); bytes=strlen(cp);
tqbs=qbs_new(bytes,1); tqbs=qbs_new(bytes,1);