26 lines
437 B
C
26 lines
437 B
C
#include <stdio.h>
|
|
|
|
#if defined(__is_libk)
|
|
#include <kernel/tty.h>
|
|
#ifdef __TESTING__
|
|
#include <kernel/serial.h>
|
|
#endif
|
|
#endif
|
|
|
|
int putchar(int ic) {
|
|
#if defined(__is_libk)
|
|
char c = (char) ic;
|
|
terminal_write(&c, sizeof(c));
|
|
#ifdef __TESTING__
|
|
serial_write(&c, sizeof(c));
|
|
if (c == '\n') {
|
|
char tmp = '\r';
|
|
serial_write(&tmp, sizeof(tmp));
|
|
}
|
|
#endif
|
|
#else
|
|
// TODO: Implement stdio and the write system call.
|
|
#endif
|
|
return ic;
|
|
}
|