jos/lib/console.c

26 lines
339 B
C
Raw Normal View History

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)
;
return r;
}