28 lines
534 B
C
28 lines
534 B
C
|
|
#include "file.h"
|
||
|
|
|
||
|
|
#include <stddef.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
extern int __libc_fctprintf(
|
||
|
|
void (*out)(char character, void *arg),
|
||
|
|
void *arg,
|
||
|
|
const char *format,
|
||
|
|
va_list va);
|
||
|
|
extern int __fputc(int c, struct __opaque_file *stream);
|
||
|
|
|
||
|
|
static inline void _out_file(char character, void *arg)
|
||
|
|
{
|
||
|
|
struct __opaque_file *fp = arg;
|
||
|
|
__fputc(character, fp);
|
||
|
|
}
|
||
|
|
|
||
|
|
int vprintf(const char *format, va_list arg)
|
||
|
|
{
|
||
|
|
__libc_file_lock(stdout);
|
||
|
|
|
||
|
|
int ret = __libc_fctprintf(_out_file, stdout, format, arg);
|
||
|
|
|
||
|
|
__libc_file_unlock(stdout);
|
||
|
|
return ret;
|
||
|
|
}
|