repo.or.cz
/
mascara-docs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* more re-work
[mascara-docs.git]
/
i386
/
junos
/
ucla
/
src
/
lab3
/
lib
/
console.c
blob
885687341f7ccb3325072fb5fcd9626c77ea232e
1
2
#include <inc/string.h>
3
#include <inc/lib.h>
4
5
void
6
cputchar
(
int
ch
)
7
{
8
char
c
=
ch
;
9
10
// Unlike standard Unix's putchar,
11
// the cputchar function _always_ outputs to the system console.
12
sys_cputs
(&
c
,
1
);
13
}
14
15
int
16
getchar
(
void
)
17
{
18
int
r
;
19
// sys_cgetc does not block, but getchar should.
20
while
((
r
=
sys_cgetc
()) ==
0
)
21
;
22
return
r
;
23
}
24
25