2021-04-27 18:33:31 +02:00
|
|
|
/* Copyright (C) 2021 Logaev Maxim (turbocat2001), GPLv2 */
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "conio.h"
|
|
|
|
#include <sys/ksys.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
2022-08-02 15:30:05 +02:00
|
|
|
int vsprintf(char* s, const char* format, va_list arg)
|
2021-09-26 19:55:43 +02:00
|
|
|
{
|
|
|
|
return vsnprintf(s, STDIO_MAX_MEM, format, arg);
|
|
|
|
}
|
|
|
|
|
2022-08-02 15:30:05 +02:00
|
|
|
int vprintf(const char* format, va_list arg)
|
2021-04-27 18:33:31 +02:00
|
|
|
{
|
2022-08-02 15:30:05 +02:00
|
|
|
int len = 0;
|
|
|
|
char* s = malloc(STDIO_MAX_MEM);
|
|
|
|
if (!s) {
|
|
|
|
errno = ENOMEM;
|
|
|
|
return errno;
|
|
|
|
}
|
|
|
|
con_init();
|
|
|
|
len = vsnprintf(s, STDIO_MAX_MEM, format, arg);
|
|
|
|
con_write_string(s, len);
|
|
|
|
free(s);
|
|
|
|
return (len);
|
2021-04-27 18:33:31 +02:00
|
|
|
}
|