File:  [CSRG BSD Unix] / 43BSDTahoe / man / man3 / getlogin.3
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

.\"	@(#)getlogin.3	6.2 (Berkeley) 5/9/86
.\"
.TH GETLOGIN 3  "May 9, 1986"
.AT 3
.SH NAME
getlogin \- get login name
.SH SYNOPSIS
.B char *getlogin()
.SH DESCRIPTION
.I Getlogin
returns a pointer to the login name as found in
.IR /etc/utmp .
It may be used in conjunction with
.I getpwnam
to locate the correct password file entry when the same userid
is shared by several login names.
.PP
If
.I getlogin
is called within a process that is not attached to a
terminal, or if there is no entry in
.I /etc/utmp
for the process's terminal,
.I getlogin
returns a NULL pointer (0).
A reasonable procedure for determining the login name is to first call
.I getlogin
and if it fails, to call
.IR getpwuid ( getuid ()).
.SH FILES
/etc/utmp
.SH "SEE ALSO"
getpwent(3), utmp(5), ttyslot(3)
.SH DIAGNOSTICS
Returns a NULL pointer (0) if name not found.
.SH BUGS
The return values point to static data
whose content is overwritten by each call.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.