setbuf.c 281 B

1234567891011121314151617
  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. }