diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-20 18:15:33 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-09-20 18:15:33 +0000 |
commit | e70354929e99fcb6c23584851628242c3f4a4f22 (patch) | |
tree | 491b16c75632608846676443e224de7d78b8302a | |
parent | c283807d8d5a5d45d5fa910beaa4c4eb8ba90af7 (diff) |
Implement hardwareflow varable in tip(1) like Solaris and hf in /etc/remote.
Based on PR 3411 from Matthew Gream
Also document "tandem" variable (XON/XOFF) in tip man page.
-rw-r--r-- | share/man/man5/remote.5 | 12 | ||||
-rw-r--r-- | usr.bin/tip/cmds.c | 30 | ||||
-rw-r--r-- | usr.bin/tip/remote.c | 6 | ||||
-rw-r--r-- | usr.bin/tip/tip.1 | 24 | ||||
-rw-r--r-- | usr.bin/tip/tip.c | 6 | ||||
-rw-r--r-- | usr.bin/tip/tip.h | 4 | ||||
-rw-r--r-- | usr.bin/tip/vars.c | 6 |
7 files changed, 74 insertions, 14 deletions
diff --git a/share/man/man5/remote.5 b/share/man/man5/remote.5 index 1fea352d3af..c22836a8930 100644 --- a/share/man/man5/remote.5 +++ b/share/man/man5/remote.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: remote.5,v 1.13 2003/06/06 13:28:13 jmc Exp $ +.\" $OpenBSD: remote.5,v 1.14 2003/09/20 18:15:32 millert Exp $ .\" $NetBSD: remote.5,v 1.4 1997/04/20 00:05:27 mellon Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -204,6 +204,16 @@ The default frame size is equal to .It Sy \&hd (bool) The host uses half-duplex communication, local echo should be performed. +.It Sy \&hf +(bool) +Initialize the +.Xr tip 1 +variable +.Dq hardwareflow +to +.Sy on , +so that hardware flow control (CRTSCTS) will be used for the +connection with the remote host. .It Sy \&ie (str) Input end-of-file marks. diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c index 1ef949cec9f..e55574f0032 100644 --- a/usr.bin/tip/cmds.c +++ b/usr.bin/tip/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.16 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: cmds.c,v 1.17 2003/09/20 18:15:32 millert Exp $ */ /* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cmds.c,v 1.16 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.17 2003/09/20 18:15:32 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -783,6 +783,13 @@ variable() vtable[PARITY].v_access &= ~CHANGED; setparity(NOSTR); } + if (vtable[HARDWAREFLOW].v_access&CHANGED) { + vtable[HARDWAREFLOW].v_access &= ~CHANGED; + if (boolean(value(HARDWAREFLOW))) + hardwareflow("on"); + else + hardwareflow("off"); + } } void @@ -809,7 +816,7 @@ listvariables() break; case BOOL: printf(" %s\r\n", - boolean(p->v_value) == '!' ? "false" : "true"); + !boolean(p->v_value) ? "false" : "true"); break; case CHAR: vis(buf, character(p->v_value), VIS_WHITE|VIS_OCTAL, 0); @@ -841,6 +848,23 @@ tandem(option) } /* + * Turn hardware flow control on or off for remote tty. + */ +void +hardwareflow(option) + char *option; +{ + struct termios rmtty; + + tcgetattr(FD, &rmtty); + if (strcmp(option, "on") == 0) + rmtty.c_iflag |= CRTSCTS; + else + rmtty.c_iflag &= ~CRTSCTS; + tcsetattr(FD, TCSADRAIN, &rmtty); +} + +/* * Send a break. */ void diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c index a93c5e24413..e02e0feeaad 100644 --- a/usr.bin/tip/remote.c +++ b/usr.bin/tip/remote.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.c,v 1.12 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: remote.c,v 1.13 2003/09/20 18:15:32 millert Exp $ */ /* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */ /* @@ -41,7 +41,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: remote.c,v 1.12 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: remote.c,v 1.13 2003/09/20 18:15:32 millert Exp $"; #endif /* not lint */ #include <stdio.h> @@ -182,6 +182,8 @@ getremcap(host) setboolean(value(HALFDUPLEX), 1); if (cgetflag("dc")) setboolean(value(DC), 1); + if (cgetflag("hf")) + setboolean(value(HARDWAREFLOW), 1); if (RE == NOSTR) RE = (char *)"tip.record"; if (EX == NOSTR) diff --git a/usr.bin/tip/tip.1 b/usr.bin/tip/tip.1 index 87d05926a7c..8a675d673cd 100644 --- a/usr.bin/tip/tip.1 +++ b/usr.bin/tip/tip.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tip.1,v 1.28 2003/09/04 22:14:43 jmc Exp $ +.\" $OpenBSD: tip.1,v 1.29 2003/09/20 18:15:32 millert Exp $ .\" $NetBSD: tip.1,v 1.7 1994/12/08 09:31:05 jtc Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 @@ -342,8 +342,8 @@ and .Dq eofwrite variables are used to recognize end-of-file when reading, and specify end-of-file when writing (see below). -File transfers normally depend on tandem mode for flow control. -If the remote system does not support tandem mode, +File transfers normally depend on hardwareflow or tandem mode for flow control. +If the remote system does not support hardwareflow or tandem mode, .Dq echocheck may be set to indicate .Nm @@ -474,6 +474,12 @@ default value is (num) The amount of data (in bytes) to buffer between filesystem writes when receiving files; abbreviated .Ar fr . +.It Ar hardwareflow +(bool) Whether hardware flow control (CRTSCTS) is enabled for the +connection; abbreviated +.Ar hf ; +default value is +.Ql off . .It Ar host (str) The name of the host to which you are connected; abbreviated .Ar ho . @@ -536,6 +542,18 @@ beautification rules. default value is .Ar false . Each tab is expanded to 8 spaces. +.It Ar tandem +(bool) Use XON/XOFF flow control to throttle data from the remote host; +abbreviated +.Ar ta . +The default value is +.Ar true +unless the +.Ar nt +capability has been specified in +.Pa /etc/remote , +in which case the default value is +.Ar false. .It Ar verbose (bool) Verbose mode; abbreviated .Ar verb ; diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index ace375b273a..b7b16439479 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.c,v 1.20 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: tip.c,v 1.21 2003/09/20 18:15:32 millert Exp $ */ /* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: tip.c,v 1.20 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: tip.c,v 1.21 2003/09/20 18:15:32 millert Exp $"; #endif /* not lint */ /* @@ -537,6 +537,8 @@ ttysetup(speed) cntrl.c_cflag |= CS8; if (boolean(value(DC))) cntrl.c_cflag |= CLOCAL; + if (boolean(value(HARDWAREFLOW))) + cntrl.c_cflag |= CRTSCTS; cntrl.c_iflag &= ~(ISTRIP|ICRNL); cntrl.c_oflag &= ~OPOST; cntrl.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO); diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index ddf281dceb0..3540f144eb7 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.h,v 1.15 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: tip.h,v 1.16 2003/09/20 18:15:32 millert Exp $ */ /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */ /* @@ -223,6 +223,7 @@ extern value_t vtable[]; /* variable table */ #define HALFDUPLEX 30 #define LECHO 31 #define PARITY 32 +#define HARDWAREFLOW 33 #define NOVAL ((value_t *)NULL) #define NOACU ((acu_t *)NULL) @@ -286,6 +287,7 @@ void cumain(int argc, char *argv[]); void daemon_uid(void); void disconnect(char *reason); void execute(char *s); +void hardwareflow(char *option); void logent(char *group, char *num, char *acu, char *message); void loginit(void); void prtime(char *s, time_t a); diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c index 424c9e317d7..46cec2dd5b2 100644 --- a/usr.bin/tip/vars.c +++ b/usr.bin/tip/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.4 2003/06/03 02:56:18 millert Exp $ */ +/* $OpenBSD: vars.c,v 1.5 2003/09/20 18:15:32 millert Exp $ */ /* $NetBSD: vars.c,v 1.3 1994/12/08 09:31:19 jtc Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: vars.c,v 1.4 2003/06/03 02:56:18 millert Exp $"; +static const char rcsid[] = "$OpenBSD: vars.c,v 1.5 2003/09/20 18:15:32 millert Exp $"; #endif /* not lint */ #include "tip.h" @@ -110,5 +110,7 @@ value_t vtable[] = { "le", (char *)FALSE }, { "parity", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC, "par", (char *)&PA }, + { "hardwareflow", BOOL, (READ|WRITE)<<PUBLIC, + "hf", (char *)FALSE }, { NOSTR, NULL, NULL, NOSTR, NOSTR } }; |