-getchar()
-{
- char c;
- int timo;
- extern struct cpdcb_i consin[];
- extern struct cphdr *lasthdr;
-#define cpin consin[CPCONS]
-
- timo = 10000;
- uncache((char *)&lasthdr->cp_unit);
- while ((lasthdr->cp_unit&CPTAKE) == 0 && --timo)
- uncache(&lasthdr->cp_unit);
- cpin.cp_hdr.cp_unit = CPCONS; /* Resets done bit */
- cpin.cp_hdr.cp_comm = CPREAD;
- cpin.cp_hdr.cp_count = 1;
- mtpr(CPMDCB, &cpin);
- while ((cpin.cp_hdr.cp_unit & CPDONE) == 0)
- uncache(&cpin.cp_hdr.cp_unit);
- uncache(&cpin.cpi_buf[0]);
- c = cpin.cpi_buf[0] & 0x7f;
- lasthdr = (struct cphdr *)&cpin;
- if (c == '\r')
- c = '\n';
- printf("%c", c); /* takes care of interrupts & parity */
- return (c);
-}
-