summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-06-06 23:24:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-06-06 23:24:53 +0000
commit6e0ac5008146992124736a29366268c9cfa4b9e0 (patch)
tree6aa557db083520f4e51b524f983c8f4451dd05f3 /usr.bin
parentee2af0491a5327330de1729a7d335bae56ff35cc (diff)
teach tip about line disciplines; tried by mbalmer too
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tip/cmds.c20
-rw-r--r--usr.bin/tip/remote.c6
-rw-r--r--usr.bin/tip/tip.c9
-rw-r--r--usr.bin/tip/tip.h4
-rw-r--r--usr.bin/tip/vars.c6
5 files changed, 36 insertions, 9 deletions
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
index 60f903acc1e..c03934689a3 100644
--- a/usr.bin/tip/cmds.c
+++ b/usr.bin/tip/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.25 2006/03/17 19:39:46 deraadt Exp $ */
+/* $OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt 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.25 2006/03/17 19:39:46 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -64,6 +64,7 @@ static int args(char *, char **, int);
static void prtime(char *, time_t);
static void tandem(char *);
static void hardwareflow(char *);
+void linedisc(char *);
static int anyof(char *, char *);
/*
@@ -789,6 +790,10 @@ variable(int c)
else
hardwareflow("off");
}
+ if (vtable[LINEDISC].v_access&CHANGED) {
+ vtable[LINEDISC].v_access &= ~CHANGED;
+ linedisc(NOSTR);
+ }
}
/*ARGSUSED*/
@@ -863,6 +868,17 @@ hardwareflow(char *option)
}
/*
+ * Change line discipline to the specified one.
+ */
+void
+linedisc(char *option)
+{
+ int ld = (int)value(LINEDISC);
+
+ ioctl(FD, TIOCSETD, &ld);
+}
+
+/*
* Send a break.
*/
/*ARGSUSED*/
diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c
index 1384d5c6ba2..249b315fe05 100644
--- a/usr.bin/tip/remote.c
+++ b/usr.bin/tip/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.15 2006/03/17 14:43:06 moritz Exp $ */
+/* $OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt 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.15 2006/03/17 14:43:06 moritz Exp $";
+static const char rcsid[] = "$OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -122,6 +122,8 @@ getremcap(char *host)
cgetstr(bp, *p, *q);
if (!BR && (cgetnum(bp, "br", &BR) == -1))
BR = DEFBR;
+ if (!LD && (cgetnum(bp, "ld", &LD) == -1))
+ LD = TTYDISC;
if (cgetnum(bp, "fs", &FS) == -1)
FS = DEFFS;
if (DU < 0)
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
index c6ffbf5faf9..2a9d7c68fc5 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.c,v 1.28 2006/03/17 21:43:51 deraadt Exp $ */
+/* $OpenBSD: tip.c,v 1.29 2006/06/06 23:24:52 deraadt 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.28 2006/03/17 21:43:51 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: tip.c,v 1.29 2006/06/06 23:24:52 deraadt Exp $";
#endif /* not lint */
/*
@@ -226,6 +226,11 @@ cucommon:
pipe(fildes); pipe(repdes);
(void)signal(SIGALRM, timeout);
+ if (value(LINEDISC) != TTYDISC) {
+ int ld = (int)value(LINEDISC);
+ ioctl(FD, TIOCSETD, &ld);
+ }
+
/*
* Everything's set up now:
* connection established (hardwired or dialup)
diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h
index 0fbe15488af..1e82091c2b5 100644
--- a/usr.bin/tip/tip.h
+++ b/usr.bin/tip/tip.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.h,v 1.25 2006/03/17 21:43:51 deraadt Exp $ */
+/* $OpenBSD: tip.h,v 1.26 2006/06/06 23:24:52 deraadt Exp $ */
/* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */
/*
@@ -87,6 +87,7 @@ char *PR; /* remote prompt */
long DL; /* line delay for file transfers to remote */
long CL; /* char delay for file transfers to remote */
long ET; /* echocheck timeout */
+long LD; /* line disc */
short HD; /* this host is half duplex - do local echo */
short DC; /* this host is directly connected. */
@@ -225,6 +226,7 @@ extern value_t vtable[]; /* variable table */
#define LECHO 31
#define PARITY 32
#define HARDWAREFLOW 33
+#define LINEDISC 34
#define NOVAL ((value_t *)NULL)
#define NOACU ((acu_t *)NULL)
diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c
index 7b94cde540d..c7e21171712 100644
--- a/usr.bin/tip/vars.c
+++ b/usr.bin/tip/vars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vars.c,v 1.6 2006/01/01 22:34:07 djm Exp $ */
+/* $OpenBSD: vars.c,v 1.7 2006/06/06 23:24:52 deraadt 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.6 2006/01/01 22:34:07 djm Exp $";
+static const char rcsid[] = "$OpenBSD: vars.c,v 1.7 2006/06/06 23:24:52 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -112,5 +112,7 @@ value_t vtable[] = {
"par", (char *)&PA },
{ "hardwareflow", BOOL, (READ|WRITE)<<PUBLIC,
"hf", (char *)FALSE },
+ { "linedisc", NUMBER|IREMOTE|INIT, (READ|WRITE)<<PUBLIC,
+ "ld", (char *)&LD },
{ NOSTR, NULL, NULL, NOSTR, NOSTR }
};