summaryrefslogtreecommitdiffstats
path: root/usr.bin/key
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-07-16 06:51:12 +0000
committercharnier <charnier@FreeBSD.org>1997-07-16 06:51:12 +0000
commit97c57a650febc37e6d1dd4ec0c0a0d39c8173125 (patch)
treee16ecf141c76166e4500d3f4d1bbf0282c99272f /usr.bin/key
parent7eee0066aef806d3b3e3de7dbb9f594e839145d3 (diff)
downloadFreeBSD-src-97c57a650febc37e6d1dd4ec0c0a0d39c8173125.zip
FreeBSD-src-97c57a650febc37e6d1dd4ec0c0a0d39c8173125.tar.gz
Use err(3). Rewrote man page in mdoc format.
Diffstat (limited to 'usr.bin/key')
-rw-r--r--usr.bin/key/key.159
-rw-r--r--usr.bin/key/skey.c43
2 files changed, 46 insertions, 56 deletions
diff --git a/usr.bin/key/key.1 b/usr.bin/key/key.1
index 7399233..aaeadd8 100644
--- a/usr.bin/key/key.1
+++ b/usr.bin/key/key.1
@@ -1,24 +1,26 @@
-.ll 6i
-.pl 10.5i
-.\" @(#)key.1 1.0 (Bellcore) 12/2/91
+.\" from: @(#)key.1 1.0 (Bellcore) 12/2/91
+.\" $Id$
.\"
-.lt 6.0i
-.TH KEY 1 "2 December 1991"
-.AT 3
-.SH NAME
-key \- Stand\-alone program for computing responses to S/Key challenges.
-.SH SYNOPSIS
-.B key [\-n <count>] <Sequence> <key>
-.SH DESCRIPTION
-.I key
-Takes the optional count of the number of one time access
+.Dd December 2, 1991
+.Dt KEY 1
+.Os
+.Sh NAME
+.Nm key
+.Nd stand\-alone program for computing responses to S/Key challenges
+.Sh SYNOPSIS
+.Nm
+.Op Fl n Ar count
+.Ar sequence
+.Ar key
+.Sh DESCRIPTION
+.Nm Key
+takes the optional count of the number of one time access
passwords to print
along with a (maximum) sequence number and key as command line args,
it prompts for the user's secret password, and produces both word
and hex format responses.
-.SH EXAMPLE
-.sh
- Usage example:
+.Sh EXAMPLE
+Usage example:
.sp 0
>key \-n 5 99 th91334
.sp 0
@@ -29,21 +31,18 @@ and hex format responses.
.... 4 more passwords.
.sp 0
>
-.LP
-.SH OPTIONS
-.LP
-.B \-n <count>
-the number of one time access passwords to print.
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl n Ar count
+The number of one time access passwords to print.
The default is one.
-.SH DIAGNOSTICS
-.SH BUGS
-.LP
-.SH SEE ALSO
-.BR skey(1),
-.BR keyinit(1),
+.El
+.Sh SEE ALSO
+.Xr keyinfo 1 ,
+.Xr keyinit 1 ,
+.Xr skey 1
.\" .BR keysu(1),
-.BR keyinfo(1)
-.SH AUTHOR
+.Sh AUTHOR
Command by Phil Karn, Neil M. Haller, John S. Walden
-.SH CONTACT
+.Sh CONTACT
staff@thumper.bellcore.com
diff --git a/usr.bin/key/skey.c b/usr.bin/key/skey.c
index 0196ebe..42ef6c5 100644
--- a/usr.bin/key/skey.c
+++ b/usr.bin/key/skey.c
@@ -9,9 +9,12 @@
* C848 666B 6435 0A93
* >
*/
+
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef __MSDOS__
#include <dos.h>
@@ -21,11 +24,7 @@
#include <skey.h>
-char *readpass();
-void usage();
-int getopt();
-extern int optind;
-extern char *optarg;
+static void usage __P((void));
int
main(argc,argv)
@@ -33,7 +32,7 @@ int argc;
char *argv[];
{
int n,cnt,i;
- char passwd[256],passwd2[256];
+ char passwd[256] /* ,passwd2[256] */;
char key[8];
char *seed;
char buf[33];
@@ -50,31 +49,25 @@ char *argv[];
/* could be in the form <number>/<seed> */
if(argc <= optind + 1){
/*look for / in it */
- if(argc <= optind){
- usage(argv[0]);
- return 1;
- }
+ if(argc <= optind)
+ usage();
slash = strchr(argv[optind], '/');
- if(slash == NULL){
- usage(argv[0]);
- return 1;
- }
+ if(slash == NULL)
+ usage();
*slash++ = '\0';
seed = slash;
if((n = atoi(argv[optind])) < 0){
fprintf(stderr,"%s not positive\n",argv[optind]);
- usage(argv[0]);
- return 1;
+ usage();
}
}
else {
if((n = atoi(argv[optind])) < 0){
fprintf(stderr,"%s not positive\n",argv[optind]);
- usage(argv[0]);
- return 1;
+ usage();
}
seed = argv[++optind];
}
@@ -95,10 +88,8 @@ char *argv[];
}
/* Crunch seed and password into starting key */
- if(keycrunch(key,seed,passwd) != 0){
- fprintf(stderr,"%s: key crunch failed\n",argv[0]);
- return 1;
- }
+ if(keycrunch(key,seed,passwd) != 0)
+ errx(1, "key crunch failed");
if(cnt == 1){
while(n-- != 0)
f(key);
@@ -121,9 +112,9 @@ char *argv[];
return 0;
}
-void
-usage(s)
-char *s;
+static void
+usage()
{
- fprintf(stderr,"Usage: %s [-n count] <sequence #>[/] <key> \n",s);
+ fprintf(stderr,"usage: key [-n count] <sequence #>[/] <key>\n");
+ exit(1);
}
OpenPOWER on IntegriCloud