macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / gen / getlogin.3
CommitLineData
3998bd0b 1.\" @(#)getlogin.3 6.3 (Berkeley) %G%
4db1fb17 2.\"
e767d426 3.TH GETLOGIN 3 ""
4db1fb17
KM
4.AT 3
5.SH NAME
6getlogin \- get login name
7.SH SYNOPSIS
8.B char *getlogin()
9.SH DESCRIPTION
10.I Getlogin
6f005db8 11returns a pointer to the login name as found in
3998bd0b 12.IR /var/run/utmp .
6f005db8 13It may be used in conjunction with
4db1fb17 14.I getpwnam
6f005db8
KM
15to locate the correct password file entry when the same userid
16is shared by several login names.
4db1fb17
KM
17.PP
18If
19.I getlogin
6f005db8 20is called within a process that is not attached to a
6646c19e 21terminal, or if there is no entry in
3998bd0b 22.I /var/run/utmp
6646c19e
JL
23for the process's terminal,
24.I getlogin
25returns a NULL pointer (0).
26A reasonable procedure for determining the login name is to first call
4db1fb17 27.I getlogin
6f005db8 28and if it fails, to call
6646c19e 29.IR getpwuid ( getuid ()).
4db1fb17 30.SH FILES
3998bd0b 31/var/run/utmp
4db1fb17 32.SH "SEE ALSO"
6646c19e 33getpwent(3), utmp(5), ttyslot(3)
4db1fb17 34.SH DIAGNOSTICS
6646c19e 35Returns a NULL pointer (0) if name not found.
4db1fb17
KM
36.SH BUGS
37The return values point to static data
38whose content is overwritten by each call.