setvbuf.c\stdio\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/stdio/setvbuf.c
blob: 6dea0ebf558c4076b95798c449a8b79994109d2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stdio_impl.h"
/* This function makes no attempt to protect the user from his/her own
 * stupidity. If called any time but when then ISO C standard specifically
 * allows it, all hell can and will break loose, especially with threads!
 *
 * This implementation ignores all arguments except the buffering type,
 * and uses the existing buffer allocated alongside the FILE object.
 * In the case of stderr where the preexisting buffer is length 1, it
 * is not possible to set line buffering or full buffering. */
int setvbuf(FILE *f, char *buf, int type, size_t size)
{
	f->lbf = EOF;
	if (type == _IONBF)
		f->buf_size = 0;
	else if (type == _IOLBF)
		f->lbf = '\n';
	f->flags |= F_SVB;
	return 0;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月22日 00:07:30 +0000

AltStyle によって変換されたページ (->オリジナル) /