|
|
1.1 ! root 1: /* ! 2: * This routine is one of the main things ! 3: * in this level of curses that depends on the outside ! 4: * environment. ! 5: */ ! 6: #include "curses.ext" ! 7: /* @(#) setbuffred.c: 1.1 10/15/83 (1.7 10/27/82) */ ! 8: ! 9: static short baud_convert[] = ! 10: { ! 11: 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, ! 12: 1800, 2400, 4800, 9600, 19200, 38400 ! 13: }; ! 14: ! 15: /* ! 16: * Force output to be buffered. ! 17: * Also figures out the baud rate. ! 18: * Grouped here because they are machine dependent. ! 19: */ ! 20: _setbuffered(fd) ! 21: FILE *fd; ! 22: { ! 23: char *sobuf; ! 24: char *calloc(); ! 25: SGTTY sg; ! 26: ! 27: sobuf = calloc(1, BUFSIZ); ! 28: setbuf(fd, sobuf); ! 29: ! 30: # ifdef USG ! 31: ioctl (fileno (fd), TCGETA, &sg); ! 32: SP->baud = sg.c_cflag&CBAUD ? baud_convert[sg.c_cflag&CBAUD] : 1200; ! 33: # else ! 34: ioctl (fileno (fd), TIOCGETP, &sg); ! 35: SP->baud = sg.sg_ospeed ? baud_convert[sg.sg_ospeed] : 1200; ! 36: # endif ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.