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.4 (Berkeley) 05/05/91 8 */ 9 10 scankbd() 11 { 12 register int c; 13 14 c = cngetc(); 15 if (c == ('c'&037)) { 16 printf("^C"); 17 _stop(""); 18 /* NOTREACHED */ 19 } 20 return(c); 21 } 22 23 getchar() 24 { 25 register int c; 26 27 while((c = cngetc()) == 0) 28 ; 29 if (c == '\r') 30 c = '\n'; 31 else if (c == ('c'&037)) { 32 printf("^C"); 33 _stop(""); 34 /* NOTREACHED */ 35 } 36 putchar(c); 37 return(c); 38 } 39 40 putchar(c) 41 register int c; 42 { 43 cnputc(c); 44 if (c == '\n') 45 cnputc('\r'); 46 } 47