skey command for inline use; by brian@saturn.net (but i had to fix his sleep deprived...
authorderaadt <deraadt@openbsd.org>
Thu, 5 Sep 1996 09:10:00 +0000 (09:10 +0000)
committerderaadt <deraadt@openbsd.org>
Thu, 5 Sep 1996 09:10:00 +0000 (09:10 +0000)
usr.bin/telnet/Makefile
usr.bin/telnet/commands.c

index b1ee15e..ebd3256 100644 (file)
@@ -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
index a254d8f..c04b2f8 100644 (file)
@@ -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
 };