|
@@ -1513,7 +1513,6 @@ Vt*vread(St*st,vt*self,Vt*x){if(x==NUMS[0]){Bt*buf=Bnew();
|
|
|
Z size=ftell(fd);
|
|
|
fseek(fd,0,SEEK_SET);
|
|
|
UC*buf=ma(size+1);
|
|
|
- if(!buf)R st->udf;
|
|
|
size=fread(buf,SO(UC),size,fd);
|
|
|
fclose(fd);
|
|
|
FR(path);
|
|
@@ -1551,10 +1550,7 @@ Vt*vsystem(St*st,vt*self,Vt*x){S cmd=Vshow(x);
|
|
|
Z head=Bsize;
|
|
|
Bsize+=bytes_received;
|
|
|
if(Bsize>Ballocated){Ballocated=Bsize;
|
|
|
- if(!buffer)buffer=ma(Ballocated);
|
|
|
- else buffer=mrea(buffer,Ballocated);
|
|
|
- if(!buffer){FR(cmd);
|
|
|
- pclose(pd);R st->udf;}}
|
|
|
+ buffer=mrea(buffer,Ballocated);}
|
|
|
for(Z i=0;i<bytes_received;i++)buffer[head+i]=chunk[i];
|
|
|
if(feof(pd))BR;}
|
|
|
pclose(pd);
|
|
@@ -1634,10 +1630,7 @@ Vt*vsystem2(St*st,vt*self,Vt*x,Vt*y){S cmd=Vshow(y);
|
|
|
Z head=Bsize;
|
|
|
Bsize+=bytes_received;
|
|
|
if(Bsize>Ballocated){Ballocated=Bsize;
|
|
|
- if(!buffer)buffer=ma(Ballocated);
|
|
|
- else buffer=mrea(buffer,Ballocated);
|
|
|
- if(!buffer){FR(cmd);
|
|
|
- pclose2(pd);R st->udf;}}
|
|
|
+ buffer=mrea(buffer,Ballocated);}
|
|
|
for(Z i=0;i<bytes_received;i++)buffer[head+i]=chunk[i];
|
|
|
if(feof(pd->out))BR;}
|
|
|
pclose2(pd);
|
|
@@ -1708,7 +1701,6 @@ Vt*vimport(St*st,vt*self,Vt*x){S path=Vshow(x);
|
|
|
Z size=ftell(fd);
|
|
|
fseek(fd,0,SEEK_SET);
|
|
|
UC*buf=ma(size+1);
|
|
|
- if(!buf)R st->udf;
|
|
|
size=fread(buf,SO(UC),size,fd);
|
|
|
fclose(fd);
|
|
|
FR(path);
|
|
@@ -2589,4 +2581,5 @@ I main(I argc,S*argv){GC_INIT();
|
|
|
if(v->tag!=NIL){Tset(st->env,"it",v);
|
|
|
S s=Vshow(v);
|
|
|
fputs(s,stdout);
|
|
|
+ FR(s);
|
|
|
if(Iin)putc('\n',stdout);}}}
|