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 <w@1wt.eu>
20 #define EOF (-1)
23 /* Buffering mode used by setvbuf. */
28 /* just define FILE as a non-empty type. The value of the pointer gives
41 /* provides a FILE* equivalent of fd. The mode is ignored. */
43 FILE *fdopen(int fd, const char *mode __attribute__((unused))) in fdopen() argument
52 /* provides the fd of stream. */
54 int fileno(FILE *stream) in fileno() argument
56 intptr_t i = (intptr_t)stream; in fileno()
60 return -1; in fileno()
65 /* flush a stream. */
67 int fflush(FILE *stream) in fflush() argument
69 intptr_t i = (intptr_t)stream; in fflush()
74 return -1; in fflush()
77 /* Don't do anything, nolibc does not support buffering. */ in fflush()
81 /* flush a stream. */
83 int fclose(FILE *stream) in fclose() argument
85 intptr_t i = (intptr_t)stream; in fclose()
89 return -1; in fclose()
100 #define getc(stream) fgetc(stream) argument
103 int fgetc(FILE* stream) in fgetc() argument
107 if (read(fileno(stream), &ch, 1) <= 0) in fgetc()
121 #define putc(c, stream) fputc(c, stream) argument
124 int fputc(int c, FILE* stream) in fputc() argument
128 if (write(fileno(stream), &ch, 1) <= 0) in fputc()
142 /* internal fwrite()-like function which only takes a size and returns 0 on
146 int _fwrite(const void *buf, size_t size, FILE *stream) in _fwrite() argument
149 int fd = fileno(stream); in _fwrite()
155 size -= ret; in _fwrite()
162 size_t fwrite(const void *s, size_t size, size_t nmemb, FILE *stream) in fwrite() argument
167 if (_fwrite(s, size, stream) != 0) in fwrite()
175 int fputs(const char *s, FILE *stream) in fputs() argument
177 return _fwrite(s, strlen(s), stream); in fputs()
191 char *fgets(char *s, int size, FILE *stream) in fgets() argument
197 c = fgetc(stream); in fgets()
211 * - %[l*]{d,u,c,x,p}
212 * - %s
213 * - unknown modifiers are ignored.
216 int vfprintf(FILE *stream, const char *fmt, va_list args) in vfprintf() argument
246 /* sign-extend the value */ in vfprintf()
302 len = ofs - 1; in vfprintf()
304 if (_fwrite(outstr, len, stream) != 0) in vfprintf()
328 int fprintf(FILE *stream, const char *fmt, ...) in fprintf() argument
334 ret = vfprintf(stream, fmt, args); in fprintf()
358 int setvbuf(FILE *stream __attribute__((unused)), in setvbuf() argument
360 int mode, in setvbuf() argument
364 * nolibc does not support buffering so this is a nop. Just check mode in setvbuf()
367 switch (mode) { in setvbuf()