Subject: 2.11BSD gets RTS/CTS flow control (#371 - 3 of 3) Index: sys/tty.c,dhv.c,bin/stty.c,... 2.11BSD Description: RTS/CTS flow control, used to insure reliable communications on serial lines, is missing from 2.11BSD Repeat-By: Using C-Kermit (version 5A-188 was included in 2.11) establish a connection via a modem and a line speed of 9600 or greater. There are two things to watch for: 1) If large packets are enabled (greater than ~128 bytes) and a file transfer is started there will be many truncated or "crunched" packets. 2) During the interactive mode large sections of the output will be missing as data overruns occur. Using 'tip' (or 'cu') there will be much lost data. It should come as no surprise that XON/XOFF is not very effective over modem lines at speeds of 9600 or greater (C-kermit requires more flow control than tip due to kermit's higher cpu utilization). In both cases the data loss is made much worse if there is other activity on the system (especially in the case of an 11/73 which is not as fast as the 11/44 or 11/93). If background disk activity is started (via 'cron', 'sendmail', etc) the data loss on the serial ports will be even worse than usual. Fix: This is #371 and is part 3 of 3. Make sure you have #369 and 370 (parts 1 and 2) before proceeding with the installation of the update. This part contains the last of the three patches. As always this and previous updates to 2.11BSD are available via anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the directory /pub/2.11BSD. ----------------------------cut here----------------------------- *** /usr/src/sys/sys/tty_pty.c.old Thu Dec 8 20:21:57 1994 --- /usr/src/sys/sys/tty_pty.c Fri May 2 17:00:27 1997 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)tty_pty.c 1.2 (2.11BSD GTE) 12/8/94 */ /* --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)tty_pty.c 1.3 (2.11BSD GTE) 1997/5/2 */ /* *************** *** 24,29 **** --- 24,31 ---- #include "uio.h" #include "kernel.h" #include "inode.h" + + extern int TTYHOG; /* see tty.c */ #if NPTY == 1 #undef NPTY *** /usr/src/ucb/rlogin.c.old Wed Mar 11 11:02:07 1987 --- /usr/src/ucb/rlogin.c Fri Mar 28 14:59:42 1997 *************** *** 4,18 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; - #endif not lint ! #ifndef lint ! static char sccsid[] = "@(#)rlogin.c 5.10 (Berkeley) 3/30/86"; ! #endif not lint /* * rlogin - remote login --- 4,16 ---- * specifies the terms and conditions for redistribution. */ ! #if !defined(lint) && defined(DOSCCS) char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)rlogin.c 5.10.1 (2.11BSD) 1997/3/28"; ! #endif /* * rlogin - remote login *************** *** 168,174 **** int catchild(); int writeroob(); ! int defflags, tabflag; int deflflags; char deferase, defkill; struct tchars deftc; --- 166,172 ---- int catchild(); int writeroob(); ! int defflags; int deflflags; char deferase, defkill; struct tchars deftc; *************** *** 183,191 **** struct sgttyb sb; ioctl(0, TIOCGETP, (char *)&sb); ! defflags = sb.sg_flags; ! tabflag = defflags & TBDELAY; ! defflags &= ECHO | CRMOD; deferase = sb.sg_erase; defkill = sb.sg_kill; ioctl(0, TIOCLGET, (char *)&deflflags); --- 181,187 ---- struct sgttyb sb; ioctl(0, TIOCGETP, (char *)&sb); ! defflags = sb.sg_flags & (ECHO | CRMOD | XTABS); deferase = sb.sg_erase; defkill = sb.sg_kill; ioctl(0, TIOCLGET, (char *)&deflflags); *************** *** 560,567 **** switch (f) { case 0: ! sb.sg_flags &= ~(CBREAK|RAW|TBDELAY); ! sb.sg_flags |= defflags|tabflag; tc = &deftc; ltc = &defltc; sb.sg_kill = defkill; --- 556,563 ---- switch (f) { case 0: ! sb.sg_flags &= ~(CBREAK|RAW|XTABS); ! sb.sg_flags |= defflags; tc = &deftc; ltc = &defltc; sb.sg_kill = defkill; *************** *** 572,580 **** case 1: sb.sg_flags |= (eight ? RAW : CBREAK); sb.sg_flags &= ~defflags; ! /* preserve tab delays, but turn off XTABS */ ! if ((sb.sg_flags & TBDELAY) == XTABS) ! sb.sg_flags &= ~TBDELAY; tc = ¬c; ltc = &noltc; sb.sg_kill = sb.sg_erase = -1; --- 568,574 ---- case 1: sb.sg_flags |= (eight ? RAW : CBREAK); sb.sg_flags &= ~defflags; ! sb.sg_flags &= ~XTABS; tc = ¬c; ltc = &noltc; sb.sg_kill = sb.sg_erase = -1; *** /usr/src/ucb/tset/Makefile.old Mon Feb 16 23:51:59 1987 --- /usr/src/ucb/tset/Makefile Fri Mar 28 14:23:54 1997 *************** *** 3,20 **** # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.4 (Berkeley) 4/28/86 # DESTDIR= CFLAGS=-O SEPFLAG= -i - tset: tset.c tset.delays.h - ${CC} ${SEPFLAG} ${CFLAGS} tset.c -o tset -ltermlib ! install: tset install -s tset ${DESTDIR}/usr/ucb rm -f ${DESTDIR}/usr/ucb/reset ln ${DESTDIR}/usr/ucb/tset ${DESTDIR}/usr/ucb/reset clean: ! rm -f *.o tset reset --- 3,40 ---- # All rights reserved. The Berkeley software License Agreement # specifies the terms and conditions for redistribution. # ! # @(#)Makefile 5.4.1 (2.11BSD) 1997/3/28 # DESTDIR= CFLAGS=-O SEPFLAG= -i ! all: tset tset.0 ! ! tset: tset.o ! ${CC} ${SEPFLAG} ${CFLAGS} tset.o -o tset -ltermlib ! ! tset.0: tset.1 ! /usr/man/manroff tset.1 > tset.0 ! ! install: all install -s tset ${DESTDIR}/usr/ucb rm -f ${DESTDIR}/usr/ucb/reset ln ${DESTDIR}/usr/ucb/tset ${DESTDIR}/usr/ucb/reset + rm -f ${DESTDIR}/usr/man/cat1/reset.0 + install -c -o bin -g bin -m 444 tset.0 ${DESTDIR}/usr/man/cat1/tset.0 + ln ${DESTDIR}/usr/man/cat1/tset.0 ${DESTDIR}/usr/man/cat1/reset.0 clean: ! rm -f *.o tset tset.o tset.0 tags ! ! depend: ${SRCS} ! mkdep ${CFLAGS} ${SRCS} ! ! lint: ${SRCS} ! lint -hax ${SRCS} ! ! tags: ${SRCS} ! ctags ${SRCS} ! # DO NOT DELETE THIS LINE -- mkdep uses it. ! # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. *** /usr/src/ucb/tset/tset.1.old Sun Dec 14 15:06:33 1986 --- /usr/src/ucb/tset/tset.1 Fri Mar 28 14:18:39 1997 *************** *** 2,10 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tset.1 6.2 (Berkeley) 5/5/86 .\" ! .TH TSET 1 "May 5, 1986" .UC 4 .SH NAME tset \- terminal dependent initialization --- 2,10 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tset.1 6.2.1 (2.11BSD) 1997/3/28 .\" ! .TH TSET 1 "March 28, 1997" .UC 4 .SH NAME tset \- terminal dependent initialization *************** *** 393,399 **** This program can't intuit personal choices for erase, interrupt and line kill characters, so it leaves these set to the local system standards. - .ig .SH NOTES For compatibility with earlier versions of .I tset --- 393,398 ---- *************** *** 414,427 **** .B \-m arpanet:type .TP 10 - \fB\-E\fR c - Sets the erase character to - .I c - only if the terminal can backspace. - .TP 10 \fB\-\fR prints the terminal type on the standard output .TP 10 \fB\-r\fR prints the terminal type on the diagnostic output. - .. --- 413,420 ---- *** /usr/src/ucb/tset/tset.c.old Tue Dec 20 08:50:01 1994 --- /usr/src/ucb/tset/tset.c Fri Mar 28 11:17:43 1997 *************** *** 9,15 **** "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)tset.c 5.8.1 (2.11BSD GTE) 12/9/94"; #endif /* --- 9,15 ---- "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)tset.c 5.8.2 (2.11BSD GTE) 1997/3/28"; #endif /* *************** *** 46,52 **** ** The current terminal type can be queried. ** ** Usage: ! ** tset [-] [-EC] [-eC] [-kC] [-iC] [-s] [-h] [-u] [-r] ** [-m [ident] [test baudrate] :type] ** [-Q] [-I] [-S] [type] ** --- 46,52 ---- ** The current terminal type can be queried. ** ** Usage: ! ** tset [-] [-eC] [-kC] [-iC] [-s] [-r] ** [-m [ident] [test baudrate] :type] ** [-Q] [-I] [-S] [type] ** *************** *** 76,84 **** ** are stated, the only affect is to write ** the terminal type on the standard output. ** -r -- report to user in addition to other flags. - ** -EC -- set the erase character to C on all terminals - ** except those which cannot backspace (e.g., - ** a TTY 33). C defaults to control-H. ** -eC -- set the erase character to C on all terminals. ** C defaults to control-H. If not specified, ** the erase character is untouched; however, if --- 76,81 ---- *************** *** 98,106 **** ** -qC -- reserved for setable quit character. ** -m -- map the system identified type to some user ** specified type. The mapping can be baud rate ! ** dependent. This replaces the old -d, -p flags. ! ** (-d type -> -m dialup:type) ! ** (-p type -> -m plug:type) ** Syntax: -m identifier [test baudrate] :type ** where: ``identifier'' is terminal type found in ** /etc/ttys for this port, (abscence of an identifier --- 95,101 ---- ** -qC -- reserved for setable quit character. ** -m -- map the system identified type to some user ** specified type. The mapping can be baud rate ! ** dependent. ** Syntax: -m identifier [test baudrate] :type ** where: ``identifier'' is terminal type found in ** /etc/ttys for this port, (abscence of an identifier *************** *** 114,128 **** ** processing. This will be different for printers ** and crt's. For crts, if the baud rate is < 1200 then ** erase and kill don't remove characters from the screen. - ** -h -- don't read htmp file. Normally the terminal type - ** is determined by reading the htmp file or the - ** environment (unless some mapping is specified). - ** This forces a read of the ttytype file -- useful - ** when htmp is somehow wrong. (V6 only) - ** -u -- don't update htmp. It seemed like this should - ** be put in. Note that htmp is never actually - ** written if there are no changes, so don't bother - ** bother using this for efficiency reasons alone. ** -s -- output setenv commands for TERM. This can be ** used with ** `tset -s ...` --- 109,114 ---- *************** *** 140,150 **** ** -Q -- be quiet. don't output 'Erase set to' etc. ** -I -- don't do terminal initialization (is & if ** strings). - ** -v -- On virtual terminal systems, don't set up a - ** virtual terminal. Otherwise tset will tell - ** the operating system what kind of terminal you - ** are on (if it is a known terminal) and fix up - ** the output of -s to use virtual terminal sequences. ** ** Files: ** /etc/ttys --- 126,131 ---- *************** *** 161,169 **** ** 0 -- ok. ** ** Defined Constants: - ** DIALUP -- the type code for a dialup port. - ** PLUGBOARD -- the type code for a plugboard port. - ** ARPANET -- the type code for an arpanet port. ** BACKSPACE -- control-H, the default for -e. ** CNTL('X') -- control-X, the default for -k. ** OLDERASE -- the system default erase character. --- 142,147 ---- *************** *** 170,195 **** ** OLDKILL -- the system default kill character. ** FILEDES -- the file descriptor to do the operation ** on, nominally 1 or 2. - ** STDOUT -- the standard output file descriptor. - ** UIDMASK -- the bit pattern to mask with the getuid() - ** call to get just the user id. - ** GTTYN -- defines file containing generalized ttynames - ** and compiles code to look there. ** ** Requires: ** Routines to handle htmp, ttys, and ttycap. ** - ** Compilation Flags: - ** OLDFLAGS -- must be defined to compile code for any of - ** the -d, -p, or -a flags. - ** OLDDIALUP -- accept the -d flag. - ** OLDPLUGBOARD -- accept the -p flag. - ** OLDARPANET -- accept the -a flag. - ** V6 -- if clear, use environments, not htmp. - ** also use TIOCSETN rather than stty to avoid flushing - ** GTTYN -- if set, compiles code to look at /etc/ttys. - ** UCB_NTTY -- set to handle new tty driver modes. - ** ** Trace Flags: ** none ** --- 148,157 ---- *************** *** 218,235 **** ** Not a terminal ** Set if FILEDES is not a terminal. ** - ** Compilation Instructions: - ** cc -n -O tset.c -ltermlib - ** mv a.out tset - ** chown bin tset - ** chmod 4755 tset - ** - ** where 'bin' should be whoever owns the 'htmp' file. - ** If 'htmp' is 666, then tset need not be setuid. - ** - ** For version 6 the compile command should be: - ** cc -n -O -I/usr/include/retrofit tset.c -ltermlib -lretro -lS - ** ** Author: ** Eric Allman ** Electronics Research Labs --- 180,185 ---- *************** *** 236,241 **** --- 186,192 ---- ** U.C. Berkeley ** ** History: + ** 1997/3/28 -- major cleanup. ** 1/81 -- Added alias checking for mapping identifiers. ** 9/80 -- Added UCB_NTTY mods to setup the new tty driver. ** Added the 'reset ...' invocation. *************** *** 264,317 **** ** 10/77 -- Written. */ ! #define UCB_NTTY ! # ifdef USG ! # define index strchr ! # define rindex strrchr ! # define curerase mode.c_cc[VERASE] ! # define curkill mode.c_cc[VKILL] ! # define curintr mode.c_cc[VINTR] ! # define olderase oldmode.c_cc[VERASE] ! # define oldkill oldmode.c_cc[VKILL] ! # define oldintr oldmode.c_cc[VINTR] ! # else ! # define curerase mode.sg_erase ! # define curkill mode.sg_kill ! # define curintr tchar.t_intrc ! # define olderase oldmode.sg_erase ! # define oldkill oldmode.sg_kill ! # define oldintr oldtchar.t_intrc ! # endif ! # ifndef V6 ! # define GTTYN ! # include ! # endif ! ! # ifndef USG ! # include ! # else ! # include ! # endif ! ! # include ! # include ! # ifdef V6 ! # include ! # endif ! ! # define YES 1 ! # define NO 0 #undef CNTL ! # define CNTL(c) ((c)&037) ! # define BACKSPACE (CNTL('H')) ! # define CHK(val, dft) (val<=0 ? dft : val) ! # define isdigit(c) (c >= '0' && c <= '9') ! # define isalnum(c) (c > ' ' && (index("<@=>!:|\177", c) == NULL)) ! # define OLDERASE '#' ! # define OLDKILL '@' ! # define OLDINTR '\177' /* del */ /* default special characters */ #ifndef CERASE --- 215,247 ---- ** 10/77 -- Written. */ ! #define curerase mode.sg_erase ! #define curkill mode.sg_kill ! #define curintr tchar.t_intrc ! #define olderase oldmode.sg_erase ! #define oldkill oldmode.sg_kill ! #define oldintr oldtchar.t_intrc ! #include ! #include ! #include ! #undef putchar ! #include ! #include ! #include ! #include ! #include ! #include ! #define YES 1 ! #define NO 0 #undef CNTL ! #define CNTL(c) ((c)&037) ! #define BACKSPACE (CNTL('H')) ! #define CHK(val, dft) (val<=0 ? dft : val) ! #define OLDERASE '#' ! #define OLDKILL '@' ! #define OLDINTR '\177' /* del */ /* default special characters */ #ifndef CERASE *************** *** 338,391 **** #define CLNEXT CNTL('V') #endif ! # define FILEDES 2 /* do gtty/stty on this descriptor */ ! # define STDOUT 1 /* output of -s/-S to this descriptor */ ! # ifdef V6 ! # define UIDMASK 0377 ! # else ! # define UIDMASK -1 ! # endif ! # ifdef UCB_NTTY ! # define USAGE "usage: tset [-] [-nrsIQS] [-eC] [-kC] [-iC] [-m [ident][test speed]:type] [type]\n" ! # else ! # define USAGE "usage: tset [-] [-rsIQS] [-eC] [-kC] [-iC] [-m [ident][test speed]:type] [type]\n" ! # endif - # define OLDFLAGS - # define DIALUP "dialup" - # define OLDDIALUP "sd" - # define PLUGBOARD "plugboard" - # define OLDPLUGBOARD "sp" - /*** - # define ARPANET "arpanet" - # define OLDARPANET "sa" - /***/ - - # define DEFTYPE "unknown" - - - # ifdef GTTYN - # define NOTTY 0 - # else - # define NOTTY 'x' - # endif - /* * Baud Rate Conditionals */ ! # define ANY 0 ! # define GT 1 ! # define EQ 2 ! # define LT 4 ! # define GE (GT|EQ) ! # define LE (LT|EQ) ! # define NE (GT|LT) ! # define ALL (GT|EQ|LT) - - # define NMAP 10 struct map { --- 268,293 ---- #define CLNEXT CNTL('V') #endif ! #define FILEDES 2 /* do gtty/stty on this descriptor */ ! #define USAGE "usage: tset [-] [-nrsIQS] [-eC] [-kC] [-iC] [-m [ident][test speed]:type] [type]\n" ! #define DIALUP "dialup" ! #define PLUGBOARD "plugboard" ! #define ARPANET "arpanet" /* * Baud Rate Conditionals */ ! #define ANY 0 ! #define GT 1 ! #define EQ 2 ! #define LT 4 ! #define GE (GT|EQ) ! #define LE (LT|EQ) ! #define NE (GT|LT) ! #define ALL (GT|EQ|LT) # define NMAP 10 struct map { *************** *** 425,477 **** 0, }; - #ifdef CBVIRTTERM - struct vterm { - char cap[2]; - char *value; - } vtab [] = { - "al", "\033\120", - "cd", "\033\114", - "ce", "\033\113", - "cm", "\033\107%r%.%.", - "cl", "\033\112", - "dc", "\033\115", - "dl", "\033\116", - "ic", "\033\117", - "kl", "\033\104", - "kr", "\033\103", - "ku", "\033\101", - "kd", "\033\102", - "kh", "\033\105", - "nd", "\033\103", - "se", "\033\142\004", - "so", "\033\141\004", - "ue", "\033\142\001", - "up", "\033\101", - "us", "\033\141\001", - "\0\0", NULL, - }; - - int VirTermNo = -2; - int HasAM; /* True if terminal has automatic margins */ - # endif CBVIRTTERM - char Erase_char; /* new erase character */ char Kill_char; /* new kill character */ char Intr_char; /* new interrupt character */ - char Specialerase; /* set => Erase_char only on terminals with backspace */ - # ifdef GTTYN - char *Ttyid = NOTTY; /* terminal identifier */ - # else - char Ttyid = NOTTY; /* terminal identifier */ - # endif char *TtyType; /* type of terminal */ char *DefType; /* default type if none other computed */ char *NewType; /* mapping identifier based on old flags */ - int Mapped; /* mapping has been specified */ - int Dash_u; /* don't update htmp */ - int Dash_h; /* don't read htmp */ int DoSetenv; /* output setenv commands */ int BeQuiet; /* be quiet */ int NoInit; /* don't output initialization string */ --- 327,339 ---- *************** *** 481,589 **** int RepOnly; /* report only */ int CmndLine; /* output full command lines (-s option) */ int Ask; /* ask user for termtype */ - int DoVirtTerm = YES; /* Set up a virtual terminal */ int PadBaud; /* Min rate of padding needed */ int lines, columns; ! # define CAPBUFSIZ 1024 char Capbuf[CAPBUFSIZ]; /* line from /etc/termcap for this TtyType */ char *Ttycap; /* termcap line from termcap or environ */ - char Aliasbuf[128]; - char *Alias[16]; - - extern char *strcpy(); - extern char *index(); - - struct delay - { - int d_delay; - int d_bits; - }; - - # include "tset.delays.h" - - # ifndef USG struct sgttyb mode; struct sgttyb oldmode; struct tchars tchar; struct tchars oldtchar; ! # else ! struct termio mode; ! struct termio oldmode; ! # endif ! # ifdef CBVIRTTERM ! struct termcb block = {0, 2, 0, 0, 0, 20}; ! # endif CBVIRTTERM main(argc, argv) ! int argc; ! char *argv[]; { char buf[CAPBUFSIZ]; char termbuf[32]; ! auto char *bufp; register char *p; char *command; register int i; - # ifdef CBVIRTTERM - int j; - # endif CBVIRTTERM int Break; int Not; char *nextarg(); char *mapped(); - extern char *rindex(); struct winsize win; - # ifdef V6 - extern char *hsgettype(); - # else - extern char *getenv(); - # endif - # ifdef GTTYN - char *stypeof(); - extern char *ttyname(); - extern char *tgetstr(); - # endif char bs_char; int csh; int settle; int setmode(); - extern prc(); extern char PC; - # ifdef V6 - extern int ospeed; - # else - extern short ospeed; - # endif - # ifdef UCB_NTTY int lmode; int ldisc; (void) ioctl(FILEDES, TIOCLGET, (char *)&lmode); (void) ioctl(FILEDES, TIOCGETD, (char *)&ldisc); - # endif - # ifndef USG if (gtty(FILEDES, &mode) < 0) - # else - if (ioctl(FILEDES, TCGETA, (char *)&mode) < 0) - # endif { prs("Not a terminal\n"); exit(1); } ! bmove((char *)&mode, (char *)&oldmode, sizeof mode); ! # ifdef TIOCGETC (void) ioctl(FILEDES, TIOCGETC, (char *)&tchar); ! bmove((char *)&tchar, (char *)&oldtchar, sizeof tchar); ! # endif ! # ifndef USG ospeed = mode.sg_ospeed & 017; - # else - ospeed = mode.c_cflag & CBAUD; - # endif (void) signal(SIGINT, setmode); (void) signal(SIGQUIT, setmode); (void) signal(SIGTERM, setmode); --- 343,402 ---- int RepOnly; /* report only */ int CmndLine; /* output full command lines (-s option) */ int Ask; /* ask user for termtype */ int PadBaud; /* Min rate of padding needed */ int lines, columns; + short ospeed; ! #define CAPBUFSIZ 1024 char Capbuf[CAPBUFSIZ]; /* line from /etc/termcap for this TtyType */ char *Ttycap; /* termcap line from termcap or environ */ + char *askuser(); struct sgttyb mode; struct sgttyb oldmode; struct tchars tchar; struct tchars oldtchar; ! int prc(); ! void wrtermcap(); + extern char *tgetstr(); main(argc, argv) ! int argc; ! char *argv[]; { char buf[CAPBUFSIZ]; char termbuf[32]; ! char *bufp, *ttypath; register char *p; char *command; register int i; int Break; int Not; char *nextarg(); char *mapped(); struct winsize win; char bs_char; int csh; int settle; int setmode(); extern char PC; int lmode; int ldisc; + struct ttyent *t; (void) ioctl(FILEDES, TIOCLGET, (char *)&lmode); (void) ioctl(FILEDES, TIOCGETD, (char *)&ldisc); if (gtty(FILEDES, &mode) < 0) { prs("Not a terminal\n"); exit(1); } ! bcopy((char *)&mode, (char *)&oldmode, sizeof mode); (void) ioctl(FILEDES, TIOCGETC, (char *)&tchar); ! bcopy((char *)&tchar, (char *)&oldtchar, sizeof tchar); ospeed = mode.sg_ospeed & 017; (void) signal(SIGINT, setmode); (void) signal(SIGQUIT, setmode); (void) signal(SIGTERM, setmode); *************** *** 592,598 **** command++; else command = argv[0]; ! if (sequal(command, "reset") ) { /* * reset the teletype mode bits to a sensible state. --- 405,411 ---- command++; else command = argv[0]; ! if (!strcmp(command, "reset") ) { /* * reset the teletype mode bits to a sensible state. *************** *** 599,606 **** * Copied from the program by Kurt Shoens & Mark Horton. * Very useful after crapping out in raw. */ - # ifndef V6 - # ifdef UCB_NTTY struct ltchars ltc; if (ldisc == NTTYDISC) --- 412,417 ---- *************** *** 614,622 **** ltc.t_lnextc = CHK(ltc.t_lnextc, CLNEXT); (void) ioctl(FILEDES, TIOCSLTC, (char *)<c); } - # endif UCB_NTTY - # ifndef USG - # ifdef TIOCGETC tchar.t_intrc = CHK(tchar.t_intrc, CINTR); tchar.t_quitc = CHK(tchar.t_quitc, CQUIT); tchar.t_startc = CHK(tchar.t_startc, CSTART); --- 425,430 ---- *************** *** 624,668 **** tchar.t_eofc = CHK(tchar.t_eofc, CEOF); /* brkc is left alone */ (void) ioctl(FILEDES, TIOCSETC, (char *)&tchar); ! # endif TIOCGETC ! mode.sg_flags &= ~(RAW ! # ifdef CBREAK ! |CBREAK ! # endif CBREAK ! |VTDELAY|ALLDELAY); mode.sg_flags |= XTABS|ECHO|CRMOD|ANYP; curerase = CHK(curerase, CERASE); curkill = CHK(curkill, CKILL); curintr = CHK(curintr, CINTR); - # else USG - (void) ioctl(FILEDES, TCGETA, (char *)&mode); - curerase = CHK(curerase, OLDERASE); - curkill = CHK(curkill, OLDKILL); - curintr = CHK(curintr, OLDINTR); - mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); - mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); - - mode.c_iflag |= (BRKINT|ISTRIP|ICRNL|IXON); - mode.c_iflag &= ~(IGNBRK|PARMRK|INPCK|INLCR|IGNCR|IUCLC|IXOFF); - mode.c_oflag |= (OPOST|ONLCR); - mode.c_oflag &= ~(OLCUC|OCRNL|ONOCR|ONLRET|OFILL|OFDEL| - NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); - mode.c_cflag |= (CS7|CREAD); - mode.c_cflag &= ~(CSIZE|PARODD|CLOCAL); - mode.c_lflag |= (ISIG|ICANON|ECHO|ECHOK); - mode.c_lflag &= ~(XCASE|ECHONL|NOFLSH); - (void) ioctl(FILEDES, TCSETAW, (char *)&mode); - # endif USG - # endif V6 - Dash_u = YES; BeQuiet = YES; IsReset = YES; } ! else if (argc == 2 && sequal(argv[1], "-")) ! { RepOnly = YES; ! Dash_u = YES; ! } argc--; /* scan argument list and collect flags */ --- 432,448 ---- tchar.t_eofc = CHK(tchar.t_eofc, CEOF); /* brkc is left alone */ (void) ioctl(FILEDES, TIOCSETC, (char *)&tchar); ! mode.sg_flags &= ~(RAW | CBREAK); mode.sg_flags |= XTABS|ECHO|CRMOD|ANYP; curerase = CHK(curerase, CERASE); curkill = CHK(curkill, CKILL); curintr = CHK(curintr, CINTR); BeQuiet = YES; IsReset = YES; } ! else if (argc == 2 && !strcmp(argv[1], "-")) RepOnly = YES; ! argc--; /* scan argument list and collect flags */ *************** *** 675,697 **** Report = YES; /* report current terminal type */ else while (*p) switch (*p++) { - - # ifdef UCB_NTTY case 'n': ldisc = NTTYDISC; if (ioctl(FILEDES, TIOCSETD, (char *)&ldisc)<0) fatal("ioctl ", "new"); continue; - # endif - case 'r': /* report to user */ Ureport = YES; continue; - - case 'E': /* special erase: operate on all but TTY33 */ - Specialerase = YES; - /* explicit fall-through to -e case */ - case 'e': /* erase character */ if (*p == NULL) Erase_char = -1; --- 455,468 ---- *************** *** 707,714 **** p++; } continue; - - # if defined(USG) || defined(TIOCGETC) case 'i': /* interrupt character */ if (*p == NULL) Intr_char = CNTL('C'); --- 478,483 ---- *************** *** 724,731 **** p++; } continue; - # endif - case 'k': /* kill character */ if (*p == NULL) Kill_char = CNTL('X'); --- 493,498 ---- *************** *** 741,779 **** p++; } continue; - - # ifdef OLDFLAGS - # ifdef OLDDIALUP case 'd': /* dialup type */ NewType = DIALUP; goto mapold; - # endif - - # ifdef OLDPLUGBOARD case 'p': /* plugboard type */ NewType = PLUGBOARD; goto mapold; - # endif - - # ifdef OLDARPANET case 'a': /* arpanet type */ ! Newtype = ARPANET; ! goto mapold; ! # endif ! mapold: Map->Ident = NewType; Map->Test = ALL; if (*p == NULL) - { p = nextarg(argc--, argv++); - } Map->Type = p; Map++; - Mapped = YES; p = ""; continue; - # endif - case 'm': /* map identifier to type */ /* This code is very loose. Almost no ** syntax checking is done!! However, --- 508,529 ---- p++; } continue; case 'd': /* dialup type */ NewType = DIALUP; goto mapold; case 'p': /* plugboard type */ NewType = PLUGBOARD; goto mapold; case 'a': /* arpanet type */ ! NewType = ARPANET; mapold: Map->Ident = NewType; Map->Test = ALL; if (*p == NULL) p = nextarg(argc--, argv++); Map->Type = p; Map++; p = ""; continue; case 'm': /* map identifier to type */ /* This code is very loose. Almost no ** syntax checking is done!! However, *************** *** 850,892 **** Map->Type = p; p = ""; Map++; - Mapped = YES; continue; - - case 'h': /* don't get type from htmp or env */ - Dash_h = YES; - continue; - - case 'u': /* don't update htmp */ - Dash_u = YES; - continue; - case 's': /* output setenv commands */ DoSetenv = YES; CmndLine = YES; continue; - case 'S': /* output setenv strings */ DoSetenv = YES; CmndLine = NO; continue; - case 'Q': /* be quiet */ BeQuiet = YES; continue; - case 'I': /* no initialization */ NoInit = YES; continue; - - case 'A': /* Ask user */ - Ask = YES; - continue; - - case 'v': /* no virtual terminal */ - DoVirtTerm = NO; - continue; - default: *p-- = NULL; fatal("Bad flag -", p); --- 600,620 ---- *************** *** 893,1041 **** } } else ! { ! /* terminal type */ ! DefType = p; ! } } if (DefType) { ! if (Mapped) ! { ! Map->Ident = ""; /* means "map any type" */ ! Map->Test = ALL; /* at all baud rates */ ! Map->Type = DefType; /* to the default type */ ! } ! else ! TtyType = DefType; } - # ifndef V6 /* * Get rid of $TERMCAP, if it's there, so we get a real * entry from /etc/termcap. This prevents us from being ! * fooled by out of date stuff in the environment, and ! * makes tabs work right on CB/Unix. */ ! bufp = getenv("TERMCAP"); ! if (bufp && *bufp != '/') ! (void) strcpy(bufp-8, "NOTHING"); /* overwrite only "TERMCAP" */ /* get current idea of terminal type from environment */ ! if (!Dash_h && TtyType == 0) ! TtyType = getenv("TERM"); ! # endif ! /* determine terminal id if needed */ ! # ifdef V6 ! if (Ttyid == NOTTY && (TtyType == 0 || !Dash_h || !Dash_u)) ! Ttyid = ttyn(FILEDES); ! # else ! if (!RepOnly && Ttyid == NOTTY && (TtyType == 0 || !Dash_h)) ! Ttyid = ttyname(FILEDES); ! # endif - # ifdef V6 - /* get htmp if ever used */ - if (!Dash_u || (TtyType == 0 && !Dash_h)) - { - /* get htmp entry -- if error or wrong user use ttytype */ - if (Ttyid == NOTTY || hget(Ttyid) < 0 || - hgettype() == 0 || hgetuid() != (getuid() & UIDMASK)) - Dash_h++; - } - - /* find terminal type (if not already known) */ - if (TtyType == 0 && !Dash_h) - { - /* get type from /etc/htmp */ - TtyType = hsgettype(); - } - # endif - - # ifdef GTTYN - /* If still undefined, look at /etc/ttytype */ - if (TtyType == 0) - { - TtyType = stypeof(Ttyid); - } - # endif - - /* If still undefined, use DEFTYPE */ - if (TtyType == 0) - { - TtyType = DEFTYPE; - } - /* check for dialup or other mapping */ ! if (Mapped) ! { ! if (!(Alias[0] && isalias(TtyType))) ! if (tgetent(Capbuf, TtyType) > 0) ! makealias(Capbuf); ! TtyType = mapped(TtyType); ! } /* TtyType now contains a pointer to the type of the terminal */ /* If the first character is '?', ask the user */ ! if (TtyType[0] == '?') ! { ! Ask = YES; ! TtyType++; ! if (TtyType[0] == '\0') ! TtyType = DEFTYPE; ! } ! if (Ask) ! { ! ask: ! prs("TERM = ("); ! prs(TtyType); ! prs(") "); ! flush(); ! ! /* read the terminal. If not empty, set type */ ! i = read(2, termbuf, sizeof termbuf - 1); ! if (i > 0) { ! if (termbuf[i - 1] == '\n') ! i--; ! termbuf[i] = '\0'; ! if (termbuf[0] != '\0') ! TtyType = termbuf; } - } ! /* get terminal capabilities */ ! if (!(Alias[0] && isalias(TtyType))) { ! switch (tgetent(Capbuf, TtyType)) { ! case -1: ! prs("Cannot find termcap\n"); ! flush(); ! exit(-1); ! ! case 0: ! prs("Type "); ! prs(TtyType); ! prs(" unknown\n"); ! flush(); ! if (DoSetenv) ! { ! TtyType = DEFTYPE; ! Alias[0] = '\0'; ! goto ask; ! } ! else ! exit(1); } ! } Ttycap = Capbuf; if (!RepOnly) { /* determine erase and kill characters */ - if (Specialerase && !tgetflag("bs")) - Erase_char = 0; bufp = buf; p = tgetstr("kb", &bufp); if (p == NULL || p[1] != '\0') --- 621,695 ---- } } else ! DefType = p; /* terminal type */ } if (DefType) { ! Map->Ident = ""; /* means "map any type" */ ! Map->Test = ALL; /* at all baud rates */ ! Map->Type = DefType; /* to the default type */ } /* * Get rid of $TERMCAP, if it's there, so we get a real * entry from /etc/termcap. This prevents us from being ! * fooled by out of date stuff in the environment. */ ! unsetenv("TERMCAP"); /* get current idea of terminal type from environment */ ! if (TtyType) ! goto found; ! if (TtyType = getenv("TERM")) ! goto map; ! /* Try ttyname(3) if type is current unknown */ ! if (TtyType == 0) ! { ! if (ttypath = ttyname(FILEDES)) ! { ! if (p = rindex(ttypath, '/')) ! ++p; ! else ! p = ttypath; ! if ((t = getttynam(p))) ! TtyType = t->ty_type; ! } ! } ! /* If still undefined, use "unknown" */ ! if (TtyType == 0) ! TtyType = "unknown"; /* check for dialup or other mapping */ ! map: ! TtyType = mapped(TtyType); /* TtyType now contains a pointer to the type of the terminal */ /* If the first character is '?', ask the user */ ! found: ! if (TtyType[0] == '?') { ! if (TtyType[1] != '\0') ! TtyType = askuser(TtyType + 1); ! else ! TtyType = askuser(NULL); } ! /* Find the termcap entry. If it doesn't exist, ask the user. */ ! while ((i = tgetent(Capbuf, TtyType)) == 0) { ! (void)fprintf(stderr, "tset: terminal type %s is unknown\n", ! TtyType); ! TtyType = askuser(NULL); } ! if (i == -1) ! fatal("termcap", strerror(errno ? errno : ENOENT)); ! Ttycap = Capbuf; if (!RepOnly) { /* determine erase and kill characters */ bufp = buf; p = tgetstr("kb", &bufp); if (p == NULL || p[1] != '\0') *************** *** 1076,1091 **** PadBaud = speeds[i].speed; break; } ! # ifndef USG ! setdelay("dC", CRdelay, CRbits, &mode.sg_flags); ! setdelay("dN", NLdelay, NLbits, &mode.sg_flags); ! setdelay("dB", BSdelay, BSbits, &mode.sg_flags); ! setdelay("dF", FFdelay, FFbits, &mode.sg_flags); ! setdelay("dT", TBdelay, TBbits, &mode.sg_flags); ! mode.sg_flags &= ~(EVENP | ODDP | RAW); ! # ifdef CBREAK ! mode.sg_flags &= ~CBREAK; ! # endif if (tgetflag("EP")) mode.sg_flags |= EVENP; if (tgetflag("OP")) --- 730,736 ---- PadBaud = speeds[i].speed; break; } ! mode.sg_flags &= ~(EVENP | ODDP | RAW | CBREAK); if (tgetflag("EP")) mode.sg_flags |= EVENP; if (tgetflag("OP")) *************** *** 1099,1150 **** mode.sg_flags &= ~ECHO; if (tgetflag("pt")) /* print tabs */ mode.sg_flags &= ~XTABS; - # else - setdelay("dC", CRdelay, CRbits, &mode.c_oflag); - setdelay("dN", NLdelay, NLbits, &mode.c_oflag); - setdelay("dB", BSdelay, BSbits, &mode.c_oflag); - setdelay("dF", FFdelay, FFbits, &mode.c_oflag); - setdelay("dT", TBdelay, TBbits, &mode.c_oflag); - setdelay("dV", VTdelay, VTbits, &mode.c_oflag); - - if (tgetflag("UC") || (command[0] & 0140) == 0100) { - mode.c_iflag |= IUCLC; - mode.c_oflag |= OLCUC; - } - else if (tgetflag("LC")) { - mode.c_iflag &= ~IUCLC; - mode.c_oflag &= ~OLCUC; - } - mode.c_iflag &= ~(PARMRK|INPCK); - mode.c_lflag |= ICANON; - if (tgetflag("EP")) { - mode.c_cflag |= PARENB; - mode.c_cflag &= ~PARODD; - } - if (tgetflag("OP")) { - mode.c_cflag |= PARENB; - mode.c_cflag |= PARODD; - } - - mode.c_oflag |= ONLCR; - mode.c_iflag |= ICRNL; - mode.c_lflag |= ECHO; - mode.c_oflag |= TAB3; - if (tgetflag("NL")) { /* new line, not line feed */ - mode.c_oflag &= ~ONLCR; - mode.c_iflag &= ~ICRNL; - } - if (tgetflag("HD")) /* half duplex */ - mode.c_lflag &= ~ECHO; - if (tgetflag("pt")) /* print tabs */ - mode.c_oflag &= ~TAB3; - - mode.c_lflag |= (ECHOE|ECHOK); - # endif - # ifdef CBVIRTTERM - HasAM = tgetflag("am"); - # endif CBVIRTTERM - # ifdef UCB_NTTY if (ldisc == NTTYDISC) { lmode |= LCTLECH; /* display ctrl chars */ --- 744,749 ---- *************** *** 1167,1173 **** if (IsReset) lmode &= ~(LMDMBUF|LLITOUT|LPASS8); (void) ioctl(FILEDES, TIOCLSET, (char *)&lmode); - # endif /* get pad character */ bufp = buf; --- 766,771 ---- *************** *** 1188,1210 **** /* output startup string */ if (!NoInit) { - # ifndef USG if (oldmode.sg_flags&(XTABS|CRMOD)) { oldmode.sg_flags &= ~(XTABS|CRMOD); setmode(-1); } - # else - if (oldmode.c_oflag&(TAB3|ONLCR|OCRNL|ONLRET)) - { - oldmode.c_oflag &= (TAB3|ONLCR|OCRNL|ONLRET); - setmode(-1); - } - # endif - # ifdef CBVIRTTERM - block.st_termt = 0; - (void) ioctl(FILEDES, LDSETT, (char *)&block); - # endif CBVIRTTERM if (settabs()) { settle = YES; flush(); --- 786,796 ---- *************** *** 1232,1248 **** } } - # ifdef CBVIRTTERM - if (DoVirtTerm) { - j = tgetnum("vt"); - VirTermNo = -1; - for (i=0; vt_map[i].stdnum; i++) - if (vt_map[i].stdnum == j) - VirTermNo = vt_map[i].localnum; - } else - VirTermNo = -1; - # endif CBVIRTTERM - setmode(0); /* set new modes, if they've changed */ /* set up environment for the shell we are using */ --- 818,823 ---- *************** *** 1251,1268 **** csh = NO; if (DoSetenv) { - # ifndef V6 char *sh; if ((sh = getenv("SHELL")) && (i = strlen(sh)) >= 3) { ! if ((csh = sequal(&sh[i-3], "csh")) && CmndLine) ! (void) write(STDOUT, "set noglob;\n", 12); } if (!csh) - # endif /* running Bourne shell */ ! (void) write(STDOUT, "export TERMCAP TERM;\n", 21); } } --- 826,841 ---- csh = NO; if (DoSetenv) { char *sh; if ((sh = getenv("SHELL")) && (i = strlen(sh)) >= 3) { ! if ((csh = !strcmp(&sh[i-3], "csh")) && CmndLine) ! (void) puts("set noglob;"); } if (!csh) /* running Bourne shell */ ! (void) puts("export TERMCAP TERM;"); } } *************** *** 1269,1303 **** /* report type if appropriate */ if (DoSetenv || Report || Ureport) { ! /* if type is the short name, find first alias (if any) */ ! makealias(Ttycap); ! if (sequal(TtyType, Alias[0]) && Alias[1]) { ! TtyType = Alias[1]; ! } ! if (DoSetenv) { if (csh) { if (CmndLine) ! (void) write(STDOUT, "setenv TERM ", 12); ! (void) write(STDOUT, TtyType, strlen(TtyType)); ! (void) write(STDOUT, " ", 1); if (CmndLine) ! (void) write(STDOUT, ";\n", 2); } else ! { ! (void) write(STDOUT, "TERM=", 5); ! (void) write(STDOUT, TtyType, strlen(TtyType)); ! (void) write(STDOUT, ";\n", 2); ! } } else if (Report) ! { ! (void) write(STDOUT, TtyType, strlen(TtyType)); ! (void) write(STDOUT, "\n", 1); ! } if (Ureport) { prs("Terminal type is "); --- 842,866 ---- /* report type if appropriate */ if (DoSetenv || Report || Ureport) { ! /* ! * GET THE TERMINAL TYPE (second name in termcap entry) ! * See line 182 of 4.4's tset/tset.c ! */ if (DoSetenv) { if (csh) { if (CmndLine) ! (void) printf("%s", "setenv TERM "); ! (void) printf("%s ", TtyType); if (CmndLine) ! (void) puts(";"); } else ! (void) printf("TERM=%s;\n", TtyType); } else if (Report) ! (void) puts(TtyType); if (Ureport) { prs("Terminal type is "); *************** *** 1311,1331 **** if (csh) { if (CmndLine) ! (void) write(STDOUT, "setenv TERMCAP '", 16); } else ! (void) write(STDOUT, "TERMCAP='", 9); wrtermcap(Ttycap); if (csh) { if (CmndLine) { ! (void) write(STDOUT, "';\n", 3); ! (void) write(STDOUT, "unset noglob;\n", 14); } } else ! (void) write(STDOUT, "';\n", 3); } } --- 874,894 ---- if (csh) { if (CmndLine) ! (void) printf("setenv TERMCAP '"); } else ! (void) printf("TERMCAP='"); wrtermcap(Ttycap); if (csh) { if (CmndLine) { ! (void) puts("';"); ! (void) puts("unset noglob;"); } } else ! (void) puts("';"); } } *************** *** 1336,1370 **** reportek("Erase", curerase, olderase, OLDERASE); reportek("Kill", curkill, oldkill, OLDKILL); reportek("Interrupt", curintr, oldintr, OLDINTR); - - # ifdef V6 - /* update htmp */ - if (!Dash_u) - { - if (Ttyid == 0) - Ttyid = ttyn(FILEDES); - if (Ttyid == 'x') - { - prs("Cannot update htmp\n"); - flush(); - } - else - { - /* update htmp file only if changed */ - if (!bequal(Capbuf, hsgettype(), 2)) - { - hsettype(Capbuf[0] | (Capbuf[1] << 8)); - hput(Ttyid); - } - } - } - # endif - exit(0); } - char *tgetstr(); - /* * Set the hardware tabs on the terminal, using the ct (clear all tabs), * st (set one tab) and ch (horizontal cursor addressing) capabilities. --- 899,907 ---- *************** *** 1398,1407 **** tg_out = tgoto(set_pos, c, lines-1); if (*tg_out != 'O') tputs(tg_out, 1, prc); ! else { ! prc(' '); prc(' '); prc(' '); prc(' '); ! prc(' '); prc(' '); prc(' '); prc(' '); ! } /* set the tab */ tputs(set_tab, 0, prc); } --- 935,942 ---- tg_out = tgoto(set_pos, c, lines-1); if (*tg_out != 'O') tputs(tg_out, 1, prc); ! else ! prs(" "); /* set the tab */ tputs(set_tab, 0, prc); } *************** *** 1419,1490 **** * called with flag == 0 at end of normal mode processing. */ { - # ifndef USG struct sgttyb *ttymode; - # else - struct termio *ttymode; - # endif - # ifdef TIOCGETC struct tchars *ttytchars; - # endif if (flag < 0) { /* unconditionally reset oldmode (called from init) */ ttymode = &oldmode; - # ifdef TIOCGETC ttytchars = &oldtchar; ! # endif ! } else if (!bequal((char *)&mode, (char *)&oldmode, sizeof mode)) { ttymode = &mode; - # ifdef TIOCGETC ttytchars = &tchar; - # endif } else { /* don't need it */ ! # ifndef USG ! ttymode = (struct sgttyb *)0; ! # else ! ttymode = (struct termio *)0; ! # endif ! # ifdef TIOCGETC ! ttytchars = (struct tchars *)0; ! # endif } if (ttymode) - { - # ifdef USG - (void) ioctl(FILEDES, TCSETAW, (char *)ttymode); - # else - # ifndef V6 - /* don't flush */ (void) ioctl(FILEDES, TIOCSETN, (char *)ttymode); ! # else ! stty(FILEDES, ttymode); ! # endif ! # endif ! } ! # ifdef TIOCGETC ! if (ttytchars) { (void) ioctl(FILEDES, TIOCSETC, (char *)ttytchars); - } - # endif - # ifdef CBVIRTTERM - if (VirTermNo != -2) { - int r1, r2; - extern int errno; - - r1 = ioctl(FILEDES, LDGETT, (char *)&block); - block.st_flgs |= TM_SET; - block.st_termt = VirTermNo; - if (block.st_termt < 0) - block.st_termt = 0; - if (!HasAM) - block.st_flgs |= TM_ANL; - else - block.st_flgs &= ~TM_ANL; - r2 = ioctl(FILEDES, LDSETT, (char *)&block); - } - # endif - if (flag > 0) /* trapped signal */ exit(1); } --- 954,977 ---- * called with flag == 0 at end of normal mode processing. */ { struct sgttyb *ttymode; struct tchars *ttytchars; if (flag < 0) { /* unconditionally reset oldmode (called from init) */ ttymode = &oldmode; ttytchars = &oldtchar; ! } else if (bcmp((char *)&mode, (char *)&oldmode, sizeof mode)) { ttymode = &mode; ttytchars = &tchar; } else { /* don't need it */ ! ttymode = (struct sgttyb *)0; ! ttytchars = (struct tchars *)0; } if (ttymode) (void) ioctl(FILEDES, TIOCSETN, (char *)ttymode); ! if (ttytchars) (void) ioctl(FILEDES, TIOCSETC, (char *)ttytchars); if (flag > 0) /* trapped signal */ exit(1); } *************** *** 1532,1604 **** flush(); } - - - - setdelay(cap, dtab, bits, flags) - char *cap; - struct delay dtab[]; - int bits; - short *flags; - { - register int i; - register struct delay *p; - # ifdef V6 - extern int ospeed; - # else - extern short ospeed; - # endif - - /* see if this capability exists at all */ - i = tgetnum(cap); - if (i < 0) - i = 0; - /* No padding at speeds below PadBaud */ - if (PadBaud > ospeed) - i = 0; - - /* clear out the bits, replace with new ones */ - *flags &= ~bits; - - /* scan dtab for first entry with adequate delay */ - for (p = dtab; p->d_delay >= 0; p++) - { - if (p->d_delay >= i) - { - p++; - break; - } - } - - /* use last entry if none will do */ - *flags |= (--p)->d_bits; - } - - prs(s) ! char *s; ! { while (*s != '\0') prc(*s++); ! } - char OutBuf[256]; - int OutPtr; - prc(c) char c; ! { ! OutBuf[OutPtr++] = c; ! if (OutPtr >= sizeof OutBuf) ! flush(); ! } flush() { ! if (OutPtr > 0) ! (void) write(2, OutBuf, OutPtr); ! OutPtr = 0; } --- 1019,1041 ---- flush(); } prs(s) ! register char *s; ! { while (*s != '\0') prc(*s++); ! } prc(c) char c; ! { ! putc(c, stderr); ! } flush() { ! fflush(stderr); } *************** *** 1625,1944 **** (void) close(fd); } - - - bmove(from, to, length) - char *from; - char *to; - int length; - { - register char *p, *q; - register int i; - - i = length; - p = from; - q = to; - - while (i-- > 0) - *q++ = *p++; - } - - - - bequal(a, b, len) /* must be same thru len chars */ - char *a; - char *b; - int len; - { - register char *p, *q; - register int i; - - i = len; - p = a; - q = b; - - while ((*p == *q) && --i > 0) - { - p++; q++; - } - return ((*p == *q) && i >= 0); - } - - sequal(a, b) /* must be same thru NULL */ - char *a; - char *b; - { - register char *p = a, *q = b; - - while (*p && *q && (*p == *q)) - { - p++; q++; - } - return (*p == *q); - } - - makealias(buf) - char *buf; - { - register int i; - register char *a; - register char *b; - - Alias[0] = a = Aliasbuf; - b = buf; - i = 1; - while (*b && *b != ':') { - if (*b == '|') { - *a++ = NULL; - Alias[i++] = a; - b++; - } - else - *a++ = *b++; - } - *a = NULL; - Alias[i] = NULL; - # ifdef DEB - for(i = 0; Alias[i]; printf("A:%s\n", Alias[i++])); - # endif - } - - isalias(ident) /* is ident same as one of the aliases? */ - char *ident; - { - char **a = Alias; - - if (*a) - while (*a) - if (sequal(ident, *a)) - return(YES); - else - a++; - return(NO); - } - - # ifdef GTTYN - char * - stypeof(ttyid) - char *ttyid; - { - register char *PortType; - register char *TtyId; - struct ttyent *t; - - if (ttyid == NOTTY) - return (DEFTYPE); - - /* split off end of name */ - TtyId = ttyid; - while (*ttyid) - if (*ttyid++ == '/') - TtyId = ttyid; - - /* scan the file */ - if ((t = getttynam(TtyId)) != NULL) - { - PortType = t->ty_type; - /* get aliases from termcap entry */ - if (Mapped && tgetent(Capbuf, PortType) > 0) { - makealias(Capbuf); - if (sequal(Alias[0], PortType) && Alias[1]) - PortType = Alias[1]; - } - return (PortType); - } - return (DEFTYPE); - } - # endif - /* * routine to output the string for the environment TERMCAP variable */ - #define WHITE(c) (c == ' ' || c == '\t') - char delcap[128][2]; - int ncap = 0; wrtermcap(bp) ! char *bp; { ! char buf[CAPBUFSIZ]; ! char *p = buf; ! char *tp; ! char *putbuf(); ! int space, empty; ! # ifdef CBVIRTTERM ! register int i; ! # endif CBVIRTTERM ! /* discard names with blanks */ ! /** May not be desireable ? **/ ! while (*bp && *bp != ':') { ! if (*bp == '|') { ! tp = bp+1; ! space = NO; ! while (*tp && *tp != '|' && *tp != ':') { ! space = (space || WHITE(*tp) ); ! tp++; ! } ! if (space) { ! bp = tp; ! continue; ! } } ! *p++ = *bp++; ! } ! /**/ ! # ifdef CBVIRTTERM ! if (VirTermNo > 0) { ! p = putbuf(p, ":am"); /* All virt terms have auto margins */ ! cancelled("am"); ! } ! # endif ! while (*bp) { ! switch (*bp) { ! case ':': /* discard empty, cancelled or dupl fields */ ! tp = bp+1; ! empty = YES; ! while (*tp && *tp != ':') { ! empty = (empty && WHITE(*tp) ); ! tp++; ! } ! # ifdef CBVIRTTERM ! /* ! * Virtual terminals use ic, not im or ei. Turn ! * any of them into ic - duplicates will be cancelled ! * below. I assume that terminals needing im+ic+ei ! * are handled by the kernel. ! */ ! if (VirTermNo > 0 && !HasAM && ! (bp[1]=='i' && bp[2]=='m' || ! bp[1]=='e' && bp[2]=='i')) { ! bp[1] = 'i'; ! bp[2] = 'c'; ! } ! if (VirTermNo > 0 && !HasAM && ! (bp[1]=='c' && bp[2]=='s')) { ! bp[1] = 'd'; ! bp[2] = 'l'; ! /* Also need al, so kludge: */ ! if (!cancelled("al")) ! p = putbuf(p, ":al=\033\120"); ! } ! # endif CBVIRTTERM ! if (empty || cancelled(bp+1)) { ! bp = tp; ! continue; ! } ! # ifdef CBVIRTTERM ! if (VirTermNo > 0 && !HasAM) ! for (i = 0; vtab[i].value; i++) { ! if (vtab[i].cap[0] == bp[1] && ! vtab[i].cap[1] == bp[2]) { ! *p++ = *bp++; /* colon */ ! *p++ = *bp++; /* first char */ ! *p++ = *bp++; /* second " */ ! *p++ = *bp++; /* = sign */ ! p = putbuf(p, vtab[i].value); ! bp = tp; ! goto contin; ! } ! } ! # endif CBVIRTTERM ! break; ! ! case ' ': /* no spaces in output */ ! p = putbuf(p, "\\040"); ! bp++; continue; ! ! case '!': /* the shell thinks this is history */ ! p = putbuf(p, "\\041"); ! bp++; ! continue; ! ! case ',': /* the shell thinks this is history */ ! p = putbuf(p, "\\054"); ! bp++; ! continue; ! ! case '"': /* no quotes in output */ ! p = putbuf(p, "\\042"); ! bp++; ! continue; ! ! case '\'': /* no quotes in output */ ! p = putbuf(p, "\\047"); ! bp++; ! continue; ! ! case '`': /* no back quotes in output */ ! p = putbuf(p, "\\140"); ! bp++; ! continue; ! ! case '\\': ! case '^': /* anything following is OK */ ! *p++ = *bp++; ! # ifdef CBVIRTTERM ! if (*bp == 'E' && VirTermNo > 0 && ! (bp[-3]!='\\'||bp[-2]!='E') && ! (bp[1]!='\\'||bp[2]!='E')) ! p = putbuf(p, "E\\"); ! # endif CBVIRTTERM } ! *p++ = *bp++; ! # ifdef CBVIRTTERM ! contin: ; ! # endif CBVIRTTERM } - *p++ = ':'; /* we skipped the last : with the : lookahead hack */ - (void) write (STDOUT, buf, p-buf); } - cancelled(cap) - char *cap; - { - register int i; - - for (i = 0; i < ncap; i++) - { - if (cap[0] == delcap[i][0] && cap[1] == delcap[i][1]) - return (YES); - } - /* delete a second occurrance of the same capability */ - delcap[ncap][0] = cap[0]; - delcap[ncap][1] = cap[1]; - ncap++; - return (cap[2] == '@'); - } - - char * - putbuf(ptr, str) - char *ptr; - char *str; - { - char buf[20]; - - while (*str) { - switch (*str) { - case '\033': - ptr = putbuf(ptr, "\\E"); - str++; - break; - default: - if (*str <= ' ') { - (void) sprintf(buf, "\\%03o", *str); - ptr = putbuf(ptr, buf); - str++; - } else - *ptr++ = *str++; - } - } - return (ptr); - } - - baudrate(p) char *p; { --- 1062,1137 ---- (void) close(fd); } /* * routine to output the string for the environment TERMCAP variable */ + void wrtermcap(bp) ! char *bp; { ! register int ch; ! register char *p; ! char *t, *sep; ! /* Find the end of the terminal names. */ ! if ((t = index(bp, ':')) == NULL) ! fatal("termcap names not colon terminated", ""); ! *t++ = '\0'; ! ! /* Output terminal names that don't have whitespace. */ ! sep = ""; ! while ((p = strsep(&bp, "|")) != NULL) ! if (*p != '\0' && strpbrk(p, " \t") == NULL) { ! (void)printf("%s%s", sep, p); ! sep = "|"; } ! (void)putchar(':'); ! /* ! * Output fields, transforming any dangerous characters. Skip ! * empty fields or fields containing only whitespace. ! */ ! while ((p = strsep(&t, ":")) != NULL) { ! while ((ch = *p) != '\0' && isspace(ch)) ! ++p; ! if (ch == '\0') continue; ! while ((ch = *p++) != '\0') ! switch(ch) { ! case '\033': ! (void)printf("\\E"); ! case ' ': /* No spaces. */ ! (void)printf("\\040"); ! break; ! case '!': /* No csh history chars. */ ! (void)printf("\\041"); ! break; ! case ',': /* No csh history chars. */ ! (void)printf("\\054"); ! break; ! case '"': /* No quotes. */ ! (void)printf("\\042"); ! break; ! case '\'': /* No quotes. */ ! (void)printf("\\047"); ! break; ! case '`': /* No quotes. */ ! (void)printf("\\140"); ! break; ! case '\\': /* Anything following is OK. */ ! case '^': ! (void)putchar(ch); ! if ((ch = *p++) == '\0') ! break; ! /* FALLTHROUGH */ ! default: ! (void)putchar(ch); } ! (void)putchar(':'); } } baudrate(p) char *p; { *************** *** 1949,1955 **** buf[i++] = *p++; buf[i] = NULL; for (i=0; speeds[i].string; i++) ! if (sequal(speeds[i].string, buf)) return (speeds[i].speed); return (-1); } --- 1142,1148 ---- buf[i++] = *p++; buf[i] = NULL; for (i=0; speeds[i].string; i++) ! if (!strcmp(speeds[i].string, buf)) return (speeds[i].speed); return (-1); } *************** *** 1958,1968 **** mapped(type) char *type; { - # ifdef V6 - extern int ospeed; - # else - extern short ospeed; - # endif int match; # ifdef DEB --- 1151,1156 ---- *************** *** 1972,1978 **** Map = map; while (Map->Ident) { ! if (*(Map->Ident) == NULL || sequal(Map->Ident, type) || isalias(Map->Ident)) { match = NO; switch (Map->Test) --- 1160,1166 ---- Map = map; while (Map->Ident) { ! if (*(Map->Ident) == NULL || !strcmp(Map->Ident, type)) { match = NO; switch (Map->Test) *************** *** 2041,2053 **** } fatal (mesg, obj) ! char *mesg; ! char *obj; ! { ! prs (mesg); ! prs (obj); ! prc ('\n'); ! prs (USAGE); ! flush(); exit(1); } --- 1229,1274 ---- } fatal (mesg, obj) ! char *mesg, *obj; ! { ! ! fprintf(stderr, "%s%s\n%s", mesg, obj, USAGE); exit(1); + } + + /* Prompt the user for a terminal type. */ + char * + askuser(dflt) + char *dflt; + { + static char answer[64]; + char *p; + + /* We can get recalled; if so, don't continue uselessly. */ + if (feof(stdin) || ferror(stdin)) { + (void)fprintf(stderr, "\n"); + exit(1); + } + for (;;) { + if (dflt) + (void)fprintf(stderr, "Terminal type? [%s] ", dflt); + else + (void)fprintf(stderr, "Terminal type? "); + (void)fflush(stderr); + + if (fgets(answer, sizeof(answer), stdin) == NULL) { + if (dflt == NULL) { + (void)fprintf(stderr, "\n"); + exit(1); + } + return (dflt); + } + + if (p = index(answer, '\n')) + *p = '\0'; + if (answer[0]) + return (answer); + if (dflt != NULL) + return (dflt); + } } *** /usr/src/ucb/vmstat.c.old Mon Jan 10 22:32:12 1994 --- /usr/src/ucb/vmstat.c Fri Mar 28 22:14:25 1997 *************** *** 9,15 **** "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)vmstat.c 5.4.1 (2.11BSD GTE) 12/31/93"; #endif #include --- 9,15 ---- "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)vmstat.c 5.4.2 (2.11BSD GTE) 1997/3/28"; #endif #include *************** *** 485,491 **** dotimes() { #ifdef pdp11 ! printf("page in/out/reclamation is not applicable to 2.10BSD\n"); #else lseek(mf, (long)nl[X_REC].n_value, L_SET); read(mf, &s.rectime, sizeof s.rectime); --- 485,491 ---- dotimes() { #ifdef pdp11 ! printf("page in/out/reclamation is not applicable to 2.11BSD\n"); #else lseek(mf, (long)nl[X_REC].n_value, L_SET); read(mf, &s.rectime, sizeof s.rectime); *************** *** 617,623 **** long nintv; { #ifdef pdp11 ! printf("Device interrupt statistics are not applicable to 2.10BSD\n"); #else int nintr, inttotal; long *intrcnt; --- 617,623 ---- long nintv; { #ifdef pdp11 ! printf("Device interrupt statistics are not applicable to 2.11BSD\n"); #else int nintr, inttotal; long *intrcnt; *** /usr/src/usr.bin/tabs.c.old Tue Dec 20 08:50:04 1994 --- /usr/src/usr.bin/tabs.c Fri Mar 28 15:07:53 1997 *************** *** 1,4 **** ! static char *sccsid = "@(#)tabs.c 4.1.1 (2.11BSD) 12/9/94"; #include #include --- 1,7 ---- ! #if !defined(lint) && defined(DOSCCS) ! static char *sccsid = "@(#)tabs.c 4.1.2 (2.11BSD) 1997/3/28"; ! #endif ! #include #include *************** *** 156,165 **** dasi450() { - struct sgttyb t; - gtty(0,&t); - t.sg_flags &= ~ALLDELAY; - stty(0,&t); clear(8); bs(16); margin(8); escape(MGN); nl(); tabs(16); escape(RHM); nl(); } --- 159,164 ---- *************** *** 176,186 **** tn300() { - struct sgttyb t; - gtty(0,&t); - t.sg_flags &= ~ALLDELAY; - t.sg_flags |= CR1|BS1; - stty(0,&t); clear(8); margin(8); escape(SET); tabs(14); nl(); } --- 175,180 ---- *** /usr/src/usr.bin/tip/remcap.c.old Tue Apr 30 12:35:13 1985 --- /usr/src/usr.bin/tip/remcap.c Fri May 2 02:09:43 1997 *************** *** 4,12 **** * specifies the terms and conditions for redistribution. */ ! #ifndef lint ! static char sccsid[] = "@(#)remcap.c 5.1 (Berkeley) 4/30/85"; ! #endif not lint /* * remcap - routines for dealing with the remote host data base --- 4,12 ---- * specifies the terms and conditions for redistribution. */ ! #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)remcap.c 5.1.1 (2.11BSD) 1997/5/2"; ! #endif /* * remcap - routines for dealing with the remote host data base *************** *** 255,261 **** while (*bp && *bp != ':') bp++; ! if (*bp == ':') bp++; return (bp); } --- 255,261 ---- while (*bp && *bp != ':') bp++; ! while (*bp == ':') bp++; return (bp); } *** /usr/src/man/man1/Makefile.old Wed Nov 27 21:38:45 1996 --- /usr/src/man/man1/Makefile Fri Mar 28 19:30:21 1997 *************** *** 14,20 **** # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 1.6 (2.11BSD) 1996/11/27 # MDIR= /usr/man/cat1 SRCS= adb.1 addbib.1 apply.1 apropos.1 as.1 at.1 atq.1 atrm.1 \ --- 14,20 ---- # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ! # @(#)Makefile 1.7 (2.11BSD) 1997/3/27 # MDIR= /usr/man/cat1 SRCS= adb.1 addbib.1 apply.1 apropos.1 as.1 at.1 atq.1 atrm.1 \ *************** *** 36,45 **** rlogin.1 rm.1 rmail.1 rmdir.1 roffbib.1 rsh.1 ruptime.1 rwho.1 \ sccs.1 script.1 sed.1 sendbug.1 sh.1 size.1 sleep.1 soelim.1 \ sort.1 sortbib.1 spell.1 spline.1 split.1 strcompact.1 strings.1 \ ! strip.1 struct.1 stty.1 style.1 su.1 sum.1 symcompact.1 symorder.1 \ tabs.1 tail.1 talk.1 \ tar.1 tbl.1 tc.1 tcopy.1 tee.1 telnet.1 time.1 \ ! tip.1 tk.1 tn3270.1 touch.1 tp.1 tr.1 troff.1 true.1 tset.1 \ tsort.1 tty.1 ul.1 unifdef.1 uniq.1 units.1 uptime.1 users.1 \ uucp.1 uuencode.1 uulog.1 uuname.1 uuq.1 uusend.1 uux.1 \ vacation.1 vgrind.1 vi.1 vmstat.1 vwidth.1 w.1 wait.1 wall.1 wc.1 \ --- 36,45 ---- rlogin.1 rm.1 rmail.1 rmdir.1 roffbib.1 rsh.1 ruptime.1 rwho.1 \ sccs.1 script.1 sed.1 sendbug.1 sh.1 size.1 sleep.1 soelim.1 \ sort.1 sortbib.1 spell.1 spline.1 split.1 strcompact.1 strings.1 \ ! strip.1 struct.1 style.1 su.1 sum.1 symcompact.1 symorder.1 \ tabs.1 tail.1 talk.1 \ tar.1 tbl.1 tc.1 tcopy.1 tee.1 telnet.1 time.1 \ ! tip.1 tk.1 tn3270.1 touch.1 tp.1 tr.1 troff.1 true.1 \ tsort.1 tty.1 ul.1 unifdef.1 uniq.1 units.1 uptime.1 users.1 \ uucp.1 uuencode.1 uulog.1 uuname.1 uuq.1 uusend.1 uux.1 \ vacation.1 vgrind.1 vi.1 vmstat.1 vwidth.1 w.1 wait.1 wall.1 wc.1 \ *************** *** 64,73 **** rlogin.0 rm.0 rmail.0 rmdir.0 roffbib.0 rsh.0 ruptime.0 rwho.0 \ sccs.0 script.0 sed.0 sendbug.0 sh.0 size.0 sleep.0 soelim.0 \ sort.0 sortbib.0 spell.0 spline.0 split.0 strcompact.0 strings.0 \ ! strip.0 struct.0 stty.0 style.0 su.0 sum.0 symcompact.0 symorder.0 \ tabs.0 tail.0 talk.0 \ tar.0 tbl.0 tc.0 tcopy.0 tee.0 telnet.0 time.0 \ ! tip.0 tk.0 tn3270.0 touch.0 tp.0 tr.0 troff.0 true.0 tset.0 \ tsort.0 tty.0 ul.0 unifdef.0 uniq.0 units.0 uptime.0 users.0 \ uucp.0 uuencode.0 uulog.0 uuname.0 uuq.0 uusend.0 uux.0 \ vacation.0 vgrind.0 vi.0 vmstat.0 vwidth.0 w.0 wait.0 wall.0 wc.0 \ --- 64,73 ---- rlogin.0 rm.0 rmail.0 rmdir.0 roffbib.0 rsh.0 ruptime.0 rwho.0 \ sccs.0 script.0 sed.0 sendbug.0 sh.0 size.0 sleep.0 soelim.0 \ sort.0 sortbib.0 spell.0 spline.0 split.0 strcompact.0 strings.0 \ ! strip.0 struct.0 style.0 su.0 sum.0 symcompact.0 symorder.0 \ tabs.0 tail.0 talk.0 \ tar.0 tbl.0 tc.0 tcopy.0 tee.0 telnet.0 time.0 \ ! tip.0 tk.0 tn3270.0 touch.0 tp.0 tr.0 troff.0 true.0 \ tsort.0 tty.0 ul.0 unifdef.0 uniq.0 units.0 uptime.0 users.0 \ uucp.0 uuencode.0 uulog.0 uuname.0 uuq.0 uusend.0 uux.0 \ vacation.0 vgrind.0 vi.0 vmstat.0 vwidth.0 w.0 wait.0 wall.0 wc.0 \ *************** *** 123,130 **** ln ${DESTDIR}${MDIR}/nice.0 ${DESTDIR}${MDIR}/nohup.0 rm -f ${DESTDIR}${MDIR}/page.0 ln ${DESTDIR}${MDIR}/more.0 ${DESTDIR}${MDIR}/page.0 - rm -f ${DESTDIR}${MDIR}/reset.0 - ln ${DESTDIR}${MDIR}/tset.0 ${DESTDIR}${MDIR}/reset.0 rm -f ${DESTDIR}${MDIR}/spellin.0 ln ${DESTDIR}${MDIR}/spell.0 ${DESTDIR}${MDIR}/spellin.0 rm -f ${DESTDIR}${MDIR}/spellout.0 --- 123,128 ---- *** /usr/src/man/man4/tty.4.old Fri Dec 9 20:22:11 1994 --- /usr/src/man/man4/tty.4 Mon Apr 28 19:58:11 1997 *************** *** 2,10 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tty.4 6.7.1 (2.11BSD GTE) 12/9/94 .\" ! .TH TTY 4 "August 1, 1987" .UC 4 .SH NAME tty \- general terminal interface --- 2,10 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)tty.4 6.7.2 (2.11BSD GTE) 1997/4/10 .\" ! .TH TTY 4 "April 10, 1997" .UC 4 .SH NAME tty \- general terminal interface *************** *** 129,135 **** and replaced with a newline whenever it is typed. All driver functions (input editing, interrupt generation, ! output processing such as delay generation and tab expansion, etc.) are available in this mode. .IP CBREAK 10 This mode eliminates the character, word, and line editing input facilities, --- 129,135 ---- and replaced with a newline whenever it is typed. All driver functions (input editing, interrupt generation, ! output processing such as tab expansion, etc.) are available in this mode. .IP CBREAK 10 This mode eliminates the character, word, and line editing input facilities, *************** *** 214,222 **** logically erasing the entire current input line. These characters never erase beyond the beginning of the current input line or an eof. - These characters may be entered literally by - preceding them with `\e\|'; the `\e\|' will normally be erased when the - character is typed. .PP The drivers normally treat either a carriage return or a newline character as terminating an input line, replacing the return with a newline and echoing --- 214,219 ---- *************** *** 230,238 **** in both cooked and CBREAK mode preceding .I any character to prevent its special meaning to the terminal handler. - This is to be preferred to the - use of `\e\|' escaping erase and kill characters, but `\e\|' is - retained with its old function in the new line discipline. .PP The new terminal driver also provides two other editing characters in normal mode. The word-erase character, normally ^W, erases the preceding --- 227,232 ---- *************** *** 245,252 **** .LP .B "Input echoing and redisplay" .LP ! The terminal driver has several modes (not present in standard UNIX ! Version 7 systems) for handling the echoing of terminal input, controlled by bits in a local mode word. .LP .I "Hardcopy terminals." --- 239,246 ---- .LP .B "Input echoing and redisplay" .LP ! The terminal driver has several modes ! for handling the echoing of terminal input, controlled by bits in a local mode word. .LP .I "Hardcopy terminals." *************** *** 305,322 **** should be careful. .PP The terminal drivers provide necessary processing for cooked and CBREAK mode ! output including delay generation for certain special characters and parity ! generation. Delays are available after backspaces ^H, form feeds ^L, ! carriage returns ^M, tabs ^I and newlines ^J. The driver will also optionally expand tabs into spaces, where the tab stops are assumed to be set every eight columns, and optionally convert newlines to carriage returns followed by newline. These functions are controlled by bits in the tty flags word; see \fBSummary\fR below. .PP - The terminal drivers provide for mapping between upper and lower case - on terminals lacking lower case, and for other special processing on - deficient terminals. - .PP Finally, in the new terminal driver, there is a output flush character, normally ^O, which sets the LFLUSHO bit in the local mode word, causing subsequent output to be flushed until it is cleared by a program or more --- 299,312 ---- should be careful. .PP The terminal drivers provide necessary processing for cooked and CBREAK mode ! output including parity ! generation. ! The driver will also optionally expand tabs into spaces, where the tab stops are assumed to be set every eight columns, and optionally convert newlines to carriage returns followed by newline. These functions are controlled by bits in the tty flags word; see \fBSummary\fR below. .PP Finally, in the new terminal driver, there is a output flush character, normally ^O, which sets the LFLUSHO bit in the local mode word, causing subsequent output to be flushed until it is cleared by a program or more *************** *** 341,346 **** --- 331,344 ---- ^Q) when the input has drained sufficiently. This mode is useful when the terminal is actually another machine that obeys those conventions. + .PP + If software flow control is not sufficient (it begins failing above 4800 + bits per second on slow systems) RTS/CTS flow control is now available. + Hardware flow control causes RTS to be dropped when the remote system (modem) + should cease sending and to be raised when additional data can be accepted. + If the remote system drops CTS then the local host ceases sending data until + the CTS is raised. Hardware flow control is enabled via the \fBTIOCLBIS\fP + (or TIOCLBIC or TIOCLSET) function and the bit \fBLRTSCTS\fP. .LP .B "Line control and breaks." .LP *************** *** 537,566 **** contains several bits that determine the system's treatment of the terminal: .PP ! .ta \w'ALLDELAY 'u +\w'0100000 'u .nf ! ALLDELAY 0177400 Delay algorithm selection ! BSDELAY 0100000 Select backspace delays (not implemented): ! BS0 0 ! BS1 0100000 ! VTDELAY 0040000 Select form-feed and vertical-tab delays: ! FF0 0 ! FF1 0040000 ! CRDELAY 0030000 Select carriage-return delays: ! CR0 0 ! CR1 0010000 ! CR2 0020000 ! CR3 0030000 ! TBDELAY 0006000 Select tab delays: ! TAB0 0 ! TAB1 0002000 ! TAB2 0004000 ! XTABS 0006000 ! NLDELAY 0001400 Select new-line delays: ! NL0 0 ! NL1 0000400 ! NL2 0001000 ! NL3 0001400 EVENP 0000200 Even parity allowed on input ODDP 0000100 Odd parity allowed on input RAW 0000040 Raw mode: wake up on all characters, 8-bit interface --- 535,543 ---- contains several bits that determine the system's treatment of the terminal: .PP ! .ta \w'TANDEM 'u +\w'0100000 'u .nf ! XTABS 0004000 Expand tabs on output EVENP 0000200 Even parity allowed on input ODDP 0000100 Odd parity allowed on input RAW 0000040 Raw mode: wake up on all characters, 8-bit interface *************** *** 567,604 **** CRMOD 0000020 Map CR into LF; output LF as CR-LF ECHO 0000010 Echo (full duplex) CBREAK 0000002 Return each character as soon as typed ! TANDEM 0000001 Automatic flow control .DT .fi .PP ! The delay bits specify how long ! transmission stops to allow for mechanical or other movement ! when certain characters are sent to the terminal. ! In all cases a value of 0 indicates no delay. ! .PP ! Backspace delays are currently ignored but might ! be used for Terminet 300's. ! .PP ! If a form-feed/vertical tab delay is specified, ! it lasts for about 2 seconds. ! .PP ! Carriage-return delay type 1 lasts about .08 seconds ! and is suitable for the Terminet 300. ! Delay type 2 lasts about .16 seconds and is suitable ! for the VT05 and the TI 700. ! Delay type 3 is suitable for the concept-100 and pads lines ! to be at least 9 characters at 9600 baud. ! .PP ! New-line delay type 1 is dependent on the current column ! and is tuned for Teletype model 37's. ! Type 2 is useful for the VT05 and is about .10 seconds. ! Type 3 is unimplemented and is 0. ! .PP ! Tab delay type 1 is dependent on the amount of movement ! and is tuned to the Teletype model ! 37. ! Type 3, called XTABS, ! is not a delay at all but causes tabs to be replaced by the appropriate number of spaces on output. .PP The flags for even and odd parity control parity checking on input --- 544,555 ---- CRMOD 0000020 Map CR into LF; output LF as CR-LF ECHO 0000010 Echo (full duplex) CBREAK 0000002 Return each character as soon as typed ! TANDEM 0000001 Automatic inbound xon/xoff flow control .DT .fi .PP ! XTABS, ! causes tabs to be replaced by the appropriate number of spaces on output. .PP The flags for even and odd parity control parity checking on input *************** *** 817,823 **** LTOSTOP 000100 Send SIGTTOU for background output LFLUSHO 000200 Output is being flushed LNOHANG 000400 Don't send hangup when carrier drops ! LETXACK 001000 Diablo style buffer hacking (unimplemented) LCRTKIL 002000 BS-space-BS erase entire line on line kill LPASS8 004000 Pass all 8 bits through on input, in any mode LCTLECH 010000 Echo input control chars as ^X, delete as ^? --- 768,774 ---- LTOSTOP 000100 Send SIGTTOU for background output LFLUSHO 000200 Output is being flushed LNOHANG 000400 Don't send hangup when carrier drops ! LRTSCTS 001000 RTS/CTS flow control LCRTKIL 002000 BS-space-BS erase entire line on line kill LPASS8 004000 Pass all 8 bits through on input, in any mode LCTLECH 010000 Echo input control chars as ^X, delete as ^? *** /usr/src/man/man5/gettytab.5.old Sun Dec 14 15:08:27 1986 --- /usr/src/man/man5/gettytab.5 Fri Mar 28 20:49:21 1997 *************** *** 2,10 **** .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)gettytab.5 6.3 (Berkeley) 5/19/86 .\" ! .TH GETTYTAB 5 "May 19, 1986" .UC 5 .SH NAME gettytab \- terminal configuration data base --- 2,10 ---- .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" ! .\" @(#)gettytab.5 6.3.1 (2.11BSD) 1997/3/28 .\" ! .TH GETTYTAB 5 "March 28, 1997" .UC 5 .SH NAME gettytab \- terminal configuration data base *************** *** 47,56 **** .ta \w'k0-k9 'u +\w'Type 'u +\w'``/bin/login" 'u \fBName Type Default Description\fR ap bool false terminal uses any parity - bd num 0 backspace delay bk str 0377 alternate end of line character (input break) cb bool false use crt backspace mode - cd num 0 carriage-return delay ce bool false use crt erase algorithm ck bool false use crt kill algorithm cl str NULL screen clear sequence --- 47,54 ---- *************** *** 65,74 **** f0 num unused tty mode flags to write messages f1 num unused tty mode flags to read login name f2 num unused tty mode flags to leave terminal as - fd num 0 form-feed (vertical motion) delay fl str ^O output flush character hc bool false do \s-2NOT\s0 hangup line on last close he str NULL hostname editing string hn str hostname hostname ht bool false terminal has real tabs ig bool false ignore garbage characters in login name --- 63,72 ---- f0 num unused tty mode flags to write messages f1 num unused tty mode flags to read login name f2 num unused tty mode flags to leave terminal as fl str ^O output flush character hc bool false do \s-2NOT\s0 hangup line on last close he str NULL hostname editing string + hf bool false enable hardware (rts/cts) flow control hn str hostname hostname ht bool false terminal has real tabs ig bool false ignore garbage characters in login name *************** *** 80,86 **** lm str login: login prompt ln str ^V ``literal next'' character lo str /bin/login program to exec when name obtained - nd num 0 newline (line-feed) delay nl bool false terminal has (or might have) a newline character nx str default next table (for auto speed selection) op bool false terminal uses odd parity --- 78,83 ---- *************** *** 98,104 **** to num 0 timeout (seconds) tt str NULL terminal type (for enviroment) ub bool false do unbuffered output (of prompts etc) - uc bool false terminal is known upper case only we str ^W word erase character xc bool false do \s-2NOT\s0 echo control chars as ^X xf str ^S XOFF (stop output) character --- 95,100 ---- *************** *** 135,146 **** .B nx entry. If there is none, it will re-use its original table. .PP - Delays are specified in milliseconds, the nearest possible - delay available in the tty driver will be used. - Should greater certainty be desired, delays - with values 0, 1, 2, and 3 are interpreted as - choosing that particular delay algorithm from the driver. - .PP The .B cl screen clear string may be preceded by a (decimal) number --- 131,136 ---- *************** *** 230,240 **** cases, '#' or '^H' typed in a login name will be treated as an erase character, and '@' will be treated as a kill character. .PP ! The delay stuff is a real crock. ! Apart form its general lack of flexibility, some ! of the delay algorithms are not implemented. ! The terminal driver should support sane delay settings. ! .PP The .B he capability is stupid. --- 220,227 ---- cases, '#' or '^H' typed in a login name will be treated as an erase character, and '@' will be treated as a kill character. .PP ! The delay stuff is a real crock. It has been removed from the system ! entirely. The .B he capability is stupid. *** /VERSION.old Fri Apr 18 12:42:24 1997 --- /VERSION Sun May 4 21:11:47 1997 *************** *** 1,5 **** ! Current Patch Level: 368 ! Date: April 18, 1997 2.11 BSD ============ --- 1,5 ---- ! Current Patch Level: 371 ! Date: May 4, 1997 2.11 BSD ============