userspace/libc: implement fprintf function

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-02-12 02:43:43 +02:00
parent 24fd486764
commit b05868d120
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A
2 changed files with 9 additions and 2 deletions

View File

@ -97,7 +97,7 @@ extern "C"
void flockfile(FILE *);
FILE *fmemopen(void *restrict, size_t, const char *restrict);
FILE *fopen(const char *restrict pathname, const char *restrict mode);
int fprintf(FILE *restrict, const char *restrict, ...);
int fprintf(FILE *restrict stream, const char *restrict format, ...);
int fputc(int c, FILE *stream);
int fputs(const char *restrict s, FILE *restrict stream);
size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);

View File

@ -214,7 +214,14 @@ export FILE *fopen(const char *restrict pathname, const char *restrict mode)
return file;
}
export int fprintf(FILE *restrict, const char *restrict, ...);
export int fprintf(FILE *restrict stream, const char *restrict format, ...)
{
va_list args;
va_start(args, format);
int ret = vfprintf(stream, format, args);
va_end(args);
return ret;
}
export int fputc(int c, FILE *stream)
{