9 static char *
rcsid=
"@(#)$Id$";
14 #include <sys/types.h>
37 fd=open(fname, dir, acsmode);
38 if (fd<0)
return(
NULL);
46 else if ((dir & 3)==0) {
48 else if (dir & O_WRONLY) {
58 if (pisfilestream(
s) && !isint(
s->c.fstream.fname)) {
60 if (fd>=0) stat=close(fd);
63 pointer_update(
s->c.stream.direction,
NIL);
75 register byte *strbuf;
78 strbuf=(
s->c.stream.buffer)->c.str.chars;
79 if (pisfilestream(
s)) {
80 if (isint(
s->c.fstream.fname)) {
81 lsave=
s->c.stream.buffer->c.str.length;
85 c=msgrcv(
intval(
s->c.fstream.fd),
86 strbuf-4,
intval(lsave),0,0);
88 #if system5 || Solaris2
89 if (c<0) { breakck;
goto tryqread;}
91 #if sun3 || sun4 || vax || apollo || news || sanyo || mips || alpha || Linux
94 s->c.stream.buffer->c.str.length=lsave;
95 if (c==0)
return(EOF);
100 intval((
s->c.stream.buffer)->c.str.length)););
102 printf(
";; read; stat=%d errno=%d, intsig=%d\n", c,
errno, ctx->
intsig);}
105 if (c<0)
goto tryfread;
107 if (c<=0)
return(EOF);
117 register byte *strbuf;
120 b=
s->c.stream.buffer;
121 if (elmtypeof(b)==ELM_FOREIGN) strbuf=(
byte *)(b->
c.
ivec.
iv[0]);
124 if (c>=
intval(
s->c.stream.tail)) {
127 fprintf(stderr,
"EOF ");
144 if (
ch==EOF)
return(
ch);
147 b=
s->c.stream.buffer;
148 if (elmtypeof(b)==ELM_FOREIGN) sb=(
byte *)(b->
c.
ivec.
iv[0]);
161 {
register int fno,stat,cnt,blen;
162 register pointer lsave,bstr,extstr;
166 bstr=
s->c.stream.buffer;
169 if (cnt<=0)
return(0);
170 if (pisfilestream(
s)) {
172 if (isint(
s->c.fstream.fname)) {
176 stat=msgsnd(fno,bstr->
c.
str.
chars-4,cnt,0);
184 if (stat<0) { breakck;
goto tryfwrite;}
186 #if sun3 || sun4 || apollo || vax || news || sanyo || mips || alpha
190 if (stat>=0) {
s->c.stream.count=
makeint(0);
return(0);}
198 pointer_update(
s->c.stream.buffer,extstr);
207 {
register int c,slen;
208 register byte *strbuf;
210 strbuf=(
s->c.stream.buffer)->c.str.chars;
211 slen=
intval((
s->c.stream.buffer)->c.str.length);
215 strbuf=(
s->c.stream.buffer)->c.str.chars;}
222 {
register int bcount,bsize,i=0,
count;
223 register byte *strbuf;
225 bcount=
intval(
s->c.stream.count);
226 strbuf=(
s->c.stream.buffer)->c.str.chars;
227 bsize=
intval((
s->c.stream.buffer)->c.str.length);
231 bsize=
intval((
s->c.stream.buffer)->c.str.length);
232 bcount=
intval(
s->c.stream.count);
233 strbuf=(
s->c.stream.buffer)->c.str.chars;}
235 memcpy(&strbuf[bcount], &mes[i],
count);