=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tip/Attic/cmds.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/tip/Attic/cmds.c 1995/10/18 08:46:16 1.1 +++ src/usr.bin/tip/Attic/cmds.c 1995/12/14 03:12:14 1.2 @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $ */ +/* $NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $ */ /* * Copyright (c) 1983, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $"; +static char rcsid[] = "$NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $"; #endif /* not lint */ #include "tip.h" @@ -144,15 +144,15 @@ pwrite(FD, &r, 1); do read(FD, &c, 1); - while ((c&0177) != '\n'); - ioctl(0, TIOCSETC, &defchars); + while ((c&STRIP_PAR) != '\n'); + tcsetattr(0, TCSAFLUSH, &defchars); (void) setjmp(intbuf); f = signal(SIGINT, intcopy); start = time(0); for (ct = 0; !quit;) { eof = read(FD, &c, 1) <= 0; - c &= 0177; + c &= STRIP_PAR; if (quit) continue; if (eof || any(c, eofchars)) @@ -179,7 +179,7 @@ if (boolean(value(VERBOSE))) prtime(" lines transferred in ", time(0)-start); - ioctl(0, TIOCSETC, &tchars); + tcsetattr(0, TCSAFLUSH, &term); write(fildes[1], (char *)&ccc, 1); signal(SIGINT, f); close(fd); @@ -271,12 +271,8 @@ return; } transmit(fd, value(EOFWRITE), NULL); - if (!boolean(value(ECHOCHECK))) { - struct sgttyb buf; - - ioctl(FD, TIOCGETP, &buf); /* this does a */ - ioctl(FD, TIOCSETP, &buf); /* wflushtty */ - } + if (!boolean(value(ECHOCHECK))) + tcdrain(FD); } /* @@ -295,7 +291,7 @@ kill(pid, SIGIOT); /* put TIPOUT into a wait state */ stop = 0; f = signal(SIGINT, stopsnd); - ioctl(0, TIOCSETC, &defchars); + tcsetattr(0, TCSAFLUSH, &defchars); read(repdes[0], (char *)&ccc, 1); if (command != NULL) { for (pc = command; *pc; pc++) @@ -303,10 +299,7 @@ if (boolean(value(ECHOCHECK))) read(FD, (char *)&c, 1); /* trailing \n */ else { - struct sgttyb buf; - - ioctl(FD, TIOCGETP, &buf); /* this does a */ - ioctl(FD, TIOCSETP, &buf); /* wflushtty */ + tcdrain(FD); sleep(5); /* wait for remote stty to take effect */ } } @@ -357,7 +350,7 @@ alarm(0); goto out; } - } while ((c&0177) != character(value(PROMPT))); + } while ((c&STRIP_PAR) != character(value(PROMPT))); alarm(0); } } @@ -377,7 +370,7 @@ else prtime(" lines transferred in ", stop_t-start_t); write(fildes[1], (char *)&ccc, 1); - ioctl(0, TIOCSETC, &tchars); + tcsetattr(0, TCSAFLUSH, &term); } /* @@ -472,7 +465,7 @@ kill(pid, SIGIOT); /* put TIPOUT into a wait state */ signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); - ioctl(0, TIOCSETC, &defchars); + tcsetattr(0, TCSAFLUSH, &defchars); read(repdes[0], (char *)&ccc, 1); /* * Set up file descriptors in the child and @@ -499,7 +492,7 @@ if (boolean(value(VERBOSE))) prtime("away for ", time(0)-start); write(fildes[1], (char *)&ccc, 1); - ioctl(0, TIOCSETC, &tchars); + tcsetattr(0, TCSAFLUSH, &term); signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); } @@ -523,7 +516,7 @@ kill(pid, SIGIOT); /* put TIPOUT into a wait state */ signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); - ioctl(0, TIOCSETC, &defchars); + tcsetattr(0, TCSAFLUSH, &defchars); read(repdes[0], (char *)&ccc, 1); /* * Set up file descriptors in the child and @@ -551,7 +544,7 @@ if (boolean(value(VERBOSE))) prtime("away for ", time(0)-start); write(fildes[1], (char *)&ccc, 1); - ioctl(0, TIOCSETC, &tchars); + tcsetattr(0, TCSAFLUSH, &term); signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); } @@ -771,18 +764,18 @@ tandem(option) char *option; { - struct sgttyb rmtty; + struct termios rmtty; - ioctl(FD, TIOCGETP, &rmtty); - if (strcmp(option,"on") == 0) { - rmtty.sg_flags |= TANDEM; - arg.sg_flags |= TANDEM; + tcgetattr(FD, &rmtty); + if (strcmp(option, "on") == 0) { + rmtty.c_iflag |= IXOFF; + term.c_iflag |= IXOFF; } else { - rmtty.sg_flags &= ~TANDEM; - arg.sg_flags &= ~TANDEM; + rmtty.c_iflag &= ~IXOFF; + term.c_iflag &= ~IXOFF; } - ioctl(FD, TIOCSETP, &rmtty); - ioctl(0, TIOCSETP, &arg); + tcsetattr(FD, TCSADRAIN, &rmtty); + tcsetattr(0, TCSADRAIN, &term); } /*