vxBoot/src/terminal/write.c

40 lines
770 B
C

#include "vxBoot/terminal.h"
#include <gint/display.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
/* terminal_vwrite() : printf wrapper for the terminal device with va_list */
int terminal_vwrite(const char *format, va_list ap)
{
char buffer[1024];
int nb;
/* process the format */
nb = vsnprintf(buffer, 1024, format, ap);
/* update the internal buffer */
terminal_buffer_insert(buffer, nb);
/* display the internal buffer */
dclear(terminal.private.color.bg);
terminal_buffer_display();
dupdate();
return (nb);
}
/* terminal_write() - printf wrapper for the terminal device */
int terminal_write(const char *format, ...)
{
va_list ap;
int nb;
va_start(ap, format);
nb = terminal_vwrite(format, ap);
va_end(ap);
return (nb);
}