COHERENT manpages

This page displays the COHERENT manpage for getlogin() [Get login name].

List of available manpages
Index


getlogin() -- General Function (libc)

Get login name
#include <unistd.h>
char *getlogin()

The name corresponding to the current user id is not always the same as the
name under which a user logged  into the COHERENT system.  For example, the
user may  have issued  a su  command, or there  may be several  login names
associated with a user id.  getlogin()  returns the login name found in the
file /etc/utmp.

In cases where getlogin()  fails to produce a result, getpwuid() (described
in getpwent()) is normally used to determine the user name for a process.

Files

/etc/utmp  login names

See Also

getpwent(),
getuid(),
libc,
su,
ttyname(),
unistd.h,
utmp.h,
who
POSIX Standard, §4.2.4

Diagnostics

getlogin() returns NULL if the login name cannot be determined.

Notes

getlogin() stores the  returned name in a static area  that is destroyed by
subsequent calls.