~kris/9p

9hist

ref: 6ab7f59ee49bc7c4662ab928c2da960a8b4d1f49 9hist/pc/main.c -rw-r--r-- 864 bytes
6ab7f59e — David du Colombier Plan 9 from Bell Labs 1991-07-08 35 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include	"u.h"
#include	"lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"io.h"

main(void)
{
	screeninit();
	trapinit();
	kbdinit();
	clockinit();
	mmuinit();
	floppyinit();
	spllo();
	for(;;){
		int c;

		c = getc(&kbdq);
		if(c!=-1)
			screenputc(c);
		idle();
	}
}

void
delay(int l)
{
	int i;

	while(--l){
		for(i=0; i < 100; i++)
			;
	}
}

int
sprint(char *s, char *fmt, ...)
{
	return doprint(s, s+PRINTSIZE, fmt, (&fmt+1)) - s;
}

int
print(char *fmt, ...)
{
	char buf[PRINTSIZE];
	int n;

	n = doprint(buf, buf+sizeof(buf), fmt, (&fmt+1)) - buf;
	screenputs(buf, n);
	return n;
}

void
panic(char *fmt, ...)
{
	char buf[PRINTSIZE];
	int n;

	screenputs("panic: ", 7);
	n = doprint(buf, buf+sizeof(buf), fmt, (&fmt+1)) - buf;
	screenputs(buf, n);
	screenputs("\n", 1);
	INT0ENABLE;
	spllo();
	for(;;)
		idle();
}

void
sched(void)
{
}