'\"macro stdmacro
.if n .pH g3c.getlogin @(#)getlogin	40.9 of 10/26/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} getlogin 3C "C Programming Language Utilities" "\&"
.if \nX=1 .ds x} getlogin 3C "C Programming Language Utilities"
.if \nX=2 .ds x} getlogin 3C "" "\&"
.if \nX=3 .ds x} getlogin "" "" "\&"
.TH \*(x}
.SH NAME
\f4getlogin\f1 \- get login name
.SH SYNOPSIS
\f4#include <stdlib.h>\f1
.PP
\f4char \(**getlogin (void);\f1
.SH DESCRIPTION
\f4getlogin\fP
returns a pointer to
the login name
as found in
\f4/var/adm/utmp\f1.
It may be used
in conjunction
with
\f4getpwnam\fP
to locate the correct
password file entry
when the same user
id is shared by several
login names.
.PP
If
\f4getlogin\fP
is called within a process
that is not attached to a
terminal, it returns a
null
pointer.
The correct procedure
for determining the login name
is to call
\f4cuserid\fP,
or to call
\f4getlogin\fP
and if it fails
to call
\f4getpwuid\fP.
.SH FILES
\f4/var/adm/utmp\fP
.SH SEE ALSO
\f4cuserid\fP(3S), \f4getgrent\fP(3C), \f4getpwent\fP(3C), \f4utmp\fP(4).
.SH DIAGNOSTICS
Returns
a null
pointer if
the login name is not found.
.SH NOTES
The return values point to static data
whose content is overwritten by each call.
.\"	@(#)getlogin.3c	6.2 of 10/20/83
.Ee
