jos/lib/console.c
Anish Athalye da1f8392b1 Lab 4
2018-10-08 21:32:14 -07:00

26 lines
350 B
C

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