* more re-work
[mascara-docs.git] / i386 / junos / ucla / src / lab4 / lib / console.c
blob130799392d351f539785d6c8a1a1ca597bc56763
2 #include <inc/string.h>
3 #include <inc/lib.h>
5 void
6 cputchar(int ch)
8 char c = ch;
10 // Unlike standard Unix's putchar,
11 // the cputchar function _always_ outputs to the system console.
12 sys_cputs(&c, 1);
15 int
16 getchar(void)
18 int r;
19 // sys_cgetc does not block, but getchar should.
20 while ((r = sys_cgetc()) == 0)
21 sys_yield();
22 return r;