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>
|
|
|
|
//#include "format_print.h"
|
|
|
|
|
2021-09-26 19:55:43 +02:00
|
|
|
int vsprintf (char * s, const char * format, va_list arg)
|
|
|
|
{
|
|
|
|
return vsnprintf(s, STDIO_MAX_MEM, format, arg);
|
|
|
|
}
|
|
|
|
|
2021-04-27 18:33:31 +02:00
|
|
|
int vprintf ( const char * format, va_list arg )
|
|
|
|
{
|
|
|
|
int len = 0;
|
|
|
|
char *s = malloc(STDIO_MAX_MEM);
|
|
|
|
if(!s){
|
|
|
|
errno = ENOMEM;
|
|
|
|
return errno;
|
|
|
|
}
|
2021-05-25 17:38:14 +02:00
|
|
|
con_init();
|
2021-04-27 18:33:31 +02:00
|
|
|
len = vsnprintf(s, STDIO_MAX_MEM, format, arg);
|
2021-05-25 17:38:14 +02:00
|
|
|
con_write_string(s, len);
|
2021-04-27 18:33:31 +02:00
|
|
|
free(s);
|
|
|
|
return(len);
|
|
|
|
}
|