From a657eb0e3adababc02d7494fba6200f618286ecb Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 5 Sep 1996 09:10:00 +0000 Subject: [PATCH] skey command for inline use; by brian@saturn.net (but i had to fix his sleep deprived code) --- usr.bin/telnet/Makefile | 4 ++-- usr.bin/telnet/commands.c | 40 +++++++++++++++++++++++++++++++++++++-- 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 +#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 }; -- 2.20.1