summaryrefslogtreecommitdiff
path: root/usr.bin/tip/cmds.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-09-20 18:15:33 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-09-20 18:15:33 +0000
commite70354929e99fcb6c23584851628242c3f4a4f22 (patch)
tree491b16c75632608846676443e224de7d78b8302a /usr.bin/tip/cmds.c
parentc283807d8d5a5d45d5fa910beaa4c4eb8ba90af7 (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.
Diffstat (limited to 'usr.bin/tip/cmds.c')
-rw-r--r--usr.bin/tip/cmds.c30
1 files changed, 27 insertions, 3 deletions
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