summaryrefslogtreecommitdiff
path: root/usr.bin/telnet
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-05 09:10:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-05 09:10:03 +0000
commitf3ff3e65a4211035b5fc486dfc7f4526787bc1be (patch)
tree12ad3004655880acda4d142a430b822358ae5e84 /usr.bin/telnet
parent74ce25b78fd53d753084ef14b2234bc105a4a983 (diff)
skey command for inline use; by brian@saturn.net (but i had to fix his sleep deprived code)
Diffstat (limited to 'usr.bin/telnet')
-rw-r--r--usr.bin/telnet/Makefile4
-rw-r--r--usr.bin/telnet/commands.c40
2 files changed, 40 insertions, 4 deletions
diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile
index b1ee15edd5e..ebd3256d11c 100644
--- a/usr.bin/telnet/Makefile
+++ b/usr.bin/telnet/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.2 1996/03/27 19:32:55 niklas Exp $
+# $OpenBSD: Makefile,v 1.3 1996/09/05 09:10:00 deraadt Exp $
# $NetBSD: Makefile,v 1.6 1996/02/28 21:03:49 thorpej Exp $
#
# Copyright (c) 1990 The Regents of the University of California.
@@ -37,7 +37,7 @@
PROG= telnet
-CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -Dunix
+CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DSKEY -Dunix
CFLAGS+=-DENV_HACK
CFLAGS+=-I${.CURDIR}/../../lib
LDADD+= -ltermcap -ltelnet
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index a254d8fe105..c04b2f82b29 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.5 1996/07/03 14:01:55 niklas Exp $ */
+/* $OpenBSD: commands.c,v 1.6 1996/09/05 09:10:02 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -39,7 +39,7 @@
static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $";
#else
-static char rcsid[] = "$OpenBSD: commands.c,v 1.5 1996/07/03 14:01:55 niklas Exp $";
+static char rcsid[] = "$OpenBSD: commands.c,v 1.6 1996/09/05 09:10:02 deraadt Exp $";
#endif
#endif /* not lint */
@@ -117,6 +117,39 @@ static char saveline[256];
static int margc;
static char *margv[20];
+#if defined(SKEY)
+#include <sys/wait.h>
+#define PATH_SKEY "/usr/bin/skey"
+ int
+skey_calc(argc, argv)
+ int argc;
+ char **argv;
+{
+ int status;
+
+ if(argc != 3) {
+ printf("%s sequence challenge\n", argv[0]);
+ return;
+ }
+
+ switch(fork()) {
+ case 0:
+ execv(PATH_SKEY, argv);
+ exit (1);
+ case -1:
+ perror("fork");
+ break;
+ default:
+ (void) wait(&status);
+ if (WIFEXITED(status))
+ return (WEXITSTATUS(status));
+ return (0);
+ }
+}
+#endif
+
+
+
static void
makeargv()
{
@@ -2415,6 +2448,9 @@ static Command cmdtab[] = {
#endif
{ "environ", envhelp, env_cmd, 0 },
{ "?", helphelp, help, 0 },
+#if defined(SKEY)
+ { "skey", NULL, skey_calc, 0 },
+#endif
0
};