141488Smckusick /* 241488Smckusick * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 341488Smckusick * All rights reserved. 441488Smckusick * 541488Smckusick * %sccs.include.redist.c% 641488Smckusick * 7*54073Shibler * @(#)prf.c 7.5 (Berkeley) 06/18/92 841488Smckusick */ 941488Smckusick 10*54073Shibler /* 11*54073Shibler * XXX we know that scankbd is only called from read/write to interrupt 12*54073Shibler * a boot program. Since we restart only on ^C and we do that here, we 13*54073Shibler * always return 0 to avoid a longjmp in the caller. 14*54073Shibler */ 1549160Sbostic scankbd() 1641488Smckusick { 1749160Sbostic register int c; 1841488Smckusick 1941488Smckusick c = cngetc(); 2041488Smckusick if (c == ('c'&037)) { 2141488Smckusick printf("^C"); 2241488Smckusick _stop(""); 2341488Smckusick /* NOTREACHED */ 2441488Smckusick } 25*54073Shibler return(0); 2641488Smckusick } 2741488Smckusick 2841488Smckusick getchar() 2941488Smckusick { 3049160Sbostic register int c; 3141488Smckusick 3241488Smckusick while((c = cngetc()) == 0) 3341488Smckusick ; 3441488Smckusick if (c == '\r') 3541488Smckusick c = '\n'; 3641488Smckusick else if (c == ('c'&037)) { 3741488Smckusick printf("^C"); 3841488Smckusick _stop(""); 3941488Smckusick /* NOTREACHED */ 4041488Smckusick } 41*54073Shibler if (c != '\b' && c != '\177') 42*54073Shibler putchar(c); 4341488Smckusick return(c); 4441488Smckusick } 4541488Smckusick 4649160Sbostic putchar(c) 4749160Sbostic register int c; 4841488Smckusick { 4949160Sbostic cnputc(c); 5049160Sbostic if (c == '\n') 5149160Sbostic cnputc('\r'); 5241488Smckusick } 53