summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libstdio/setvbuf.c
blob: d0b1b7640ff1e4269335bfc3d9514f6f9316727d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <sys/types.h>
#include "dietstdio.h"
#include <unistd.h>
#include "dietwarning.h"

int setvbuf(FILE *stream, char *buf, int flags , size_t size) {
#ifdef WANT_BUFFERED_STDIO
  switch (flags) {
  case _IONBF: stream->flags = (stream->flags & ~(BUFLINEWISE)) | NOBUF; break;
  case _IOLBF: stream->flags = (stream->flags & ~(BUFLINEWISE|NOBUF)) | BUFLINEWISE; break;
  case _IOFBF: stream->flags = stream->flags & ~(NOBUF | BUFLINEWISE); break;
  default: return -1;
  }
#endif
  return 0;
}

link_warning("setvbuf","setvbuf does not implement changing the buffer in diet libc.")