From ad53c0958400710a85d01ae04f2bf5bf045bf4b1 Mon Sep 17 00:00:00 2001 From: jtc Date: Sat, 28 Aug 1993 04:52:11 +0000 Subject: [PATCH] Document the fact that logname is POSIX.2 compliant. Simplify command line argument processing. --- usr.bin/logname/logname.1 | 11 +++-------- usr.bin/logname/logname.c | 14 ++++---------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/usr.bin/logname/logname.1 b/usr.bin/logname/logname.1 index 9c055c8a5d67..86e41805063d 100644 --- a/usr.bin/logname/logname.1 +++ b/usr.bin/logname/logname.1 @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)logname.1 5.2 (Berkeley) 7/23/91 -.\" $Id: logname.1,v 1.2 1993/08/01 07:31:26 mycroft Exp $ +.\" $Id: logname.1,v 1.3 1993/08/28 04:52:11 jtc Exp $ .\" .Dd "July 23, 1991" .Dt LOGNAME 1 @@ -68,10 +68,5 @@ utility exits 0 on success, and >0 if an error occurs. .Sh STANDARDS The .Nm logname -function is expected to conform to -.St -p1003.2 . -.Sh HISTORY -The -.Nm -command is -.Ud . +utility conforms to +.St -p1003.2-92 . diff --git a/usr.bin/logname/logname.c b/usr.bin/logname/logname.c index b47bccd1ca5d..ad4d3753661e 100644 --- a/usr.bin/logname/logname.c +++ b/usr.bin/logname/logname.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)logname.c 5.1 (Berkeley) 6/28/91";*/ -static char rcsid[] = "$Id: logname.c,v 1.2 1993/08/01 18:13:28 mycroft Exp $"; +static char rcsid[] = "$Id: logname.c,v 1.3 1993/08/28 04:52:12 jtc Exp $"; #endif /* not lint */ #include @@ -52,17 +52,11 @@ main(argc, argv) int argc; char *argv[]; { - int ch; char *p; - while ((ch = getopt(argc, argv, "")) != EOF) - switch(ch) { - case '?': - default: - usage(); - } - argc -= optind; - argv += optind; + if (argc != 1) { + usage(); + } if ((p = getlogin()) == NULL) { (void)fprintf(stderr, "logname: %s\n", strerror(errno));