1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 07:21:20 +03:00
Files
KernelEx/kexcrt/printf.c
2018-11-03 16:21:13 +03:00

29 lines
421 B
C
Executable File

/*
* printf.c
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#define BUFFER_SIZE 16384
int printf(const char *format, ...)
{
va_list ap;
int rv;
char buffer[BUFFER_SIZE];
va_start(ap, format);
rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
va_end(ap);
if (rv < 0)
return rv;
if (rv > BUFFER_SIZE - 1)
rv = BUFFER_SIZE - 1;
return write(1, buffer, rv);
}