xref: /original-bsd/sys/hp300/stand/prf.c (revision 13deef58)
1 /*
2  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)prf.c	7.5 (Berkeley) 06/18/92
8  */
9 
10 /*
11  * XXX we know that scankbd is only called from read/write to interrupt
12  * a boot program.  Since we restart only on ^C and we do that here, we
13  * always return 0 to avoid a longjmp in the caller.
14  */
15 scankbd()
16 {
17 	register int c;
18 
19 	c = cngetc();
20 	if (c == ('c'&037)) {
21 		printf("^C");
22 		_stop("");
23 		/* NOTREACHED */
24 	}
25 	return(0);
26 }
27 
28 getchar()
29 {
30 	register int c;
31 
32 	while((c = cngetc()) == 0)
33 		;
34 	if (c == '\r')
35 		c = '\n';
36 	else if (c == ('c'&037)) {
37 		printf("^C");
38 		_stop("");
39 		/* NOTREACHED */
40 	}
41 	if (c != '\b' && c != '\177')
42 		putchar(c);
43 	return(c);
44 }
45 
46 putchar(c)
47 	register int c;
48 {
49 	cnputc(c);
50 	if (c == '\n')
51 		cnputc('\r');
52 }
53