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