Document the fact that logname is POSIX.2 compliant.

Simplify command line argument processing.
This commit is contained in:
jtc 1993-08-28 04:52:11 +00:00
parent ca2f4c2507
commit ad53c09584
2 changed files with 7 additions and 18 deletions

View File

@ -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 .

View File

@ -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 <errno.h>
@ -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));