]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libstdio/setbuf.c
libaml: fix gc bug, need to amltake()/amldrop() temporary buffer
[plan9front.git] / sys / src / libstdio / setbuf.c
1 /*
2  * pANS stdio -- setbuf
3  */
4 #include "iolib.h"
5 void setbuf(FILE *f, char *buf){
6         if(f->state==OPEN){
7                 if(buf)
8                         f->bufl=BUFSIZ;
9                 else{
10                         buf=f->unbuf;
11                         f->bufl=0;
12                 }
13                 f->rp=f->wp=f->lp=f->buf=buf;
14                 f->state=RDWR;
15         }
16         /* else error, but there's no way to report it */
17 }