libkernaux/src/console.c

43 lines
854 B
C
Raw Normal View History

2020-11-30 11:40:33 +00:00
#include "config.h"
2020-11-30 11:32:12 +00:00
#ifdef ARCH_X86
#include <kernaux/arch/x86.h>
#endif
#include <kernaux/console.h>
#include <kernaux/printf.h>
2020-11-30 11:32:12 +00:00
#include <kernaux/stdlib.h>
void kernaux_console_print(const char *const s)
{
kernaux_console_write(s, kernaux_strlen(s));
}
2020-12-06 01:41:31 +00:00
void kernaux_console_putc(const char c __attribute__((unused)))
{
2020-11-30 11:32:12 +00:00
#ifdef ARCH_X86
kernaux_arch_x86_outportb(0x3F8, c);
#endif
}
void kernaux_console_puts(const char *const s)
{
kernaux_console_print(s);
kernaux_console_putc('\n');
}
2020-12-06 01:41:31 +00:00
void kernaux_console_write(const char *const data, const unsigned int size)
{
2020-11-30 11:32:12 +00:00
for (unsigned int i = 0; i < size; i++) {
kernaux_console_putc(data[i]);
}
}
2020-12-06 02:42:56 +00:00
void kernaux_console_printf(const char *format, ...)
{
va_list va;
va_start(va, format);
kernaux_printf_va(kernaux_console_putc, format, va);
va_end(va);
2020-12-06 02:42:56 +00:00
}