Lines Matching +full:stream +full:- +full:mode +full:- +full:support
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
4 * Copyright (C) 2017-2021 Willy Tarreau <[email protected]>
21 #define EOF (-1)
24 /* Buffering mode used by setvbuf. */
29 /* just define FILE as a non-empty type. The value of the pointer gives
42 /* provides a FILE* equivalent of fd. The mode is ignored. */
44 FILE *fdopen(int fd, const char *mode __attribute__((unused))) in fdopen() argument
53 /* provides the fd of stream. */
55 int fileno(FILE *stream) in fileno() argument
57 intptr_t i = (intptr_t)stream; in fileno()
61 return -1; in fileno()
66 /* flush a stream. */
68 int fflush(FILE *stream) in fflush() argument
70 intptr_t i = (intptr_t)stream; in fflush()
75 return -1; in fflush()
78 /* Don't do anything, nolibc does not support buffering. */ in fflush()
82 /* flush a stream. */
84 int fclose(FILE *stream) in fclose() argument
86 intptr_t i = (intptr_t)stream; in fclose()
90 return -1; in fclose()
101 #define getc(stream) fgetc(stream) argument
104 int fgetc(FILE* stream) in fgetc() argument
108 if (read(fileno(stream), &ch, 1) <= 0) in fgetc()
122 #define putc(c, stream) fputc(c, stream) argument
125 int fputc(int c, FILE* stream) in fputc() argument
129 if (write(fileno(stream), &ch, 1) <= 0) in fputc()
143 /* internal fwrite()-like function which only takes a size and returns 0 on
147 int _fwrite(const void *buf, size_t size, FILE *stream) in _fwrite() argument
150 int fd = fileno(stream); in _fwrite()
156 size -= ret; in _fwrite()
163 size_t fwrite(const void *s, size_t size, size_t nmemb, FILE *stream) in fwrite() argument
168 if (_fwrite(s, size, stream) != 0) in fwrite()
176 int fputs(const char *s, FILE *stream) in fputs() argument
178 return _fwrite(s, strlen(s), stream); in fputs()
192 char *fgets(char *s, int size, FILE *stream) in fgets() argument
198 c = fgetc(stream); in fgets()
212 * - %[l*]{d,u,c,x,p}
213 * - %s
214 * - unknown modifiers are ignored.
217 int vfprintf(FILE *stream, const char *fmt, va_list args) in vfprintf() argument
247 /* sign-extend the value */ in vfprintf()
303 len = ofs - 1; in vfprintf()
305 if (_fwrite(outstr, len, stream) != 0) in vfprintf()
329 int fprintf(FILE *stream, const char *fmt, ...) in fprintf() argument
335 ret = vfprintf(stream, fmt, args); in fprintf()
359 int setvbuf(FILE *stream __attribute__((unused)), in setvbuf() argument
361 int mode, in setvbuf() argument
365 * nolibc does not support buffering so this is a nop. Just check mode in setvbuf()
368 switch (mode) { in setvbuf()