2018-09-25 09:22:51 -07:00
|
|
|
|
|
|
|
#include <inc/string.h>
|
|
|
|
#include <inc/lib.h>
|
|
|
|
|
|
|
|
void
|
|
|
|
cputchar(int ch)
|
|
|
|
{
|
|
|
|
char c = ch;
|
|
|
|
|
|
|
|
// Unlike standard Unix's putchar,
|
|
|
|
// the cputchar function _always_ outputs to the system console.
|
|
|
|
sys_cputs(&c, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
getchar(void)
|
|
|
|
{
|
|
|
|
int r;
|
|
|
|
// sys_cgetc does not block, but getchar should.
|
|
|
|
while ((r = sys_cgetc()) == 0)
|
2018-10-06 06:52:47 -07:00
|
|
|
sys_yield();
|
2018-09-25 09:22:51 -07:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|