PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
vfprintf.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3
4#include "user/common/file.h"
5
6#define _PRINT_WRITE(ctx, buffer, count) \
7 ({ \
8 FILE* file = (FILE*)(ctx)->data; \
9 int ret = 0; \
10 if (fwrite(buffer, 1, count, file) != (size_t)(count)) \
11 { \
12 ret = EOF; \
13 } \
14 ret; \
15 })
16
17#define _PRINT_FILL(ctx, c, count) \
18 ({ \
19 FILE* file = (FILE*)(ctx)->data; \
20 int ret = 0; \
21 for (size_t i = 0; i < (size_t)(count); i++) \
22 { \
23 if (fputc((c), file) == EOF) \
24 { \
25 ret = EOF; \
26 break; \
27 } \
28 } \
29 ret; \
30 })
31
32#include "common/print.h"
33
34int vfprintf(FILE* _RESTRICT stream, const char* _RESTRICT format, va_list arg)
35{
36 return _print(format, SIZE_MAX, arg, stream);
37}
#define _RESTRICT
Definition config.h:17
static char format[MAX_NAME]
Definition screen.c:17
static int _print(const char *_RESTRICT format, size_t n, va_list arg, void *data)
Definition print.h:617
__builtin_va_list va_list
Definition stdarg.h:11
#define SIZE_MAX
Definition stdint.h:127
Definition file.h:34
int vfprintf(FILE *_RESTRICT stream, const char *_RESTRICT format, va_list arg)
Definition vfprintf.c:34