summaryrefslogtreecommitdiff
path: root/usr.bin/tip
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2006-03-29 12:37:59 +0000
committeryamt <yamt@NetBSD.org>2006-03-29 12:37:59 +0000
commit01ef02441ccbe9cf29e4dbd09695a5debe0ebc0f (patch)
tree098d3d3fb01579247fcfc6b4831039f72dfd82b3 /usr.bin/tip
parentc002406624e3a0fb9cc21c330ba3483e447d886f (diff)
pull the following change from OpenBSD
and bump date of the manpage. date: 2003/09/20 18:15:32; author: millert; state: Exp; lines: +4 -2 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.
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/cmds.c28
-rw-r--r--usr.bin/tip/remote.c6
-rw-r--r--usr.bin/tip/tip.116
-rw-r--r--usr.bin/tip/tip.c6
-rw-r--r--usr.bin/tip/tip.h4
-rw-r--r--usr.bin/tip/vars.c6
6 files changed, 55 insertions, 11 deletions
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
index bcd4c6e5651..b8738e4ac32 100644
--- a/usr.bin/tip/cmds.c
+++ b/usr.bin/tip/cmds.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cmds.c,v 1.16 2004/04/23 22:11:44 christos Exp $ */
+/* $NetBSD: cmds.c,v 1.17 2006/03/29 12:37:59 yamt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: cmds.c,v 1.16 2004/04/23 22:11:44 christos Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.17 2006/03/29 12:37:59 yamt Exp $");
#endif /* not lint */
#include "tip.h"
@@ -804,6 +804,13 @@ variable(dummy)
vtable[PARITY].v_access &= ~CHANGED;
setparity(NULL); /* XXX what is the correct arg? */
}
+ if (vtable[HARDWAREFLOW].v_access&CHANGED) {
+ vtable[HARDWAREFLOW].v_access &= ~CHANGED;
+ if (boolean(value(HARDWAREFLOW)))
+ hardwareflow("on");
+ else
+ hardwareflow("off");
+ }
}
/*
@@ -828,6 +835,23 @@ tandem(option)
}
/*
+ * Turn hardware flow control on or off for remote tty.
+ */
+void
+hardwareflow(option)
+ const 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 99ccee4f2c2..ce9199269cb 100644
--- a/usr.bin/tip/remote.c
+++ b/usr.bin/tip/remote.c
@@ -1,4 +1,4 @@
-/* $NetBSD: remote.c,v 1.11 2004/04/23 22:24:34 christos Exp $ */
+/* $NetBSD: remote.c,v 1.12 2006/03/29 12:37:59 yamt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: remote.c,v 1.11 2004/04/23 22:24:34 christos Exp $");
+__RCSID("$NetBSD: remote.c,v 1.12 2006/03/29 12:37:59 yamt Exp $");
#endif /* not lint */
#include "pathnames.h"
@@ -177,6 +177,8 @@ getremcap(host)
setboolean(value(HALFDUPLEX), 1);
if (cgetflag("dc"))
DC = 1;
+ if (cgetflag("hf"))
+ setboolean(value(HARDWAREFLOW), 1);
if (RE == NULL)
RE = tiprecord;
if (EX == NULL)
diff --git a/usr.bin/tip/tip.1 b/usr.bin/tip/tip.1
index c8c3c8754d5..797b311c8a2 100644
--- a/usr.bin/tip/tip.1
+++ b/usr.bin/tip/tip.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: tip.1,v 1.21 2004/05/09 18:59:52 snj Exp $
+.\" $NetBSD: tip.1,v 1.22 2006/03/29 12:37:59 yamt Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
.\"
-.Dd April 18, 1994
+.Dd March 29, 2006
.Dt TIP 1
.Os
.Sh NAME
@@ -405,6 +405,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 713a90193fc..7f326158b7c 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tip.c,v 1.28 2004/11/04 07:29:09 dsl Exp $ */
+/* $NetBSD: tip.c,v 1.29 2006/03/29 12:37:59 yamt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: tip.c,v 1.28 2004/11/04 07:29:09 dsl Exp $");
+__RCSID("$NetBSD: tip.c,v 1.29 2006/03/29 12:37:59 yamt Exp $");
#endif /* not lint */
/*
@@ -553,6 +553,8 @@ ttysetup(spd)
cntrl.c_cflag |= CS8;
if (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 f1c2dd01236..6ecb923fdbe 100644
--- a/usr.bin/tip/tip.h
+++ b/usr.bin/tip/tip.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tip.h,v 1.16 2004/04/23 22:11:44 christos Exp $ */
+/* $NetBSD: tip.h,v 1.17 2006/03/29 12:37:59 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -231,6 +231,7 @@ extern value_t vtable[]; /* variable table */
#define HALFDUPLEX 30
#define LECHO 31
#define PARITY 32
+#define HARDWAREFLOW 33
struct termios term; /* current mode of terminal */
struct termios defterm; /* initial mode of terminal */
@@ -286,6 +287,7 @@ void finish __P((char));
void genbrk __P((char));
void getfl __P((char));
char *getremote __P((char *));
+void hardwareflow __P((const char *));
void help __P((char));
int hunt __P((char *));
char *interp __P((const char *));
diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c
index acfb588c99b..74a8652a20b 100644
--- a/usr.bin/tip/vars.c
+++ b/usr.bin/tip/vars.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vars.c,v 1.7 2004/04/23 22:11:44 christos Exp $ */
+/* $NetBSD: vars.c,v 1.8 2006/03/29 12:37:59 yamt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: vars.c,v 1.7 2004/04/23 22:11:44 christos Exp $");
+__RCSID("$NetBSD: vars.c,v 1.8 2006/03/29 12:37:59 yamt Exp $");
#endif /* not lint */
#include "tip.h"
@@ -112,5 +112,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 },
{ NULL, 0, 0, NULL, NULL }
};