GETLOGIN(3)
NAME
getlogin − get log-in name
USAGE
char *getlogin()
DESCRIPTION
Getlogin returns a pointer to the user’s log-in name. It may be used in conjunction with getpwnam to locate the correct password file entry when several log-in names share the same user ID.
If getlogin is called within a process that is not attached to a terminal, it returns NULL. To determine the log-in name, first call getlogin; if it fails, call getpwuid(getuid()).
NOTES
The return values point to static data, which each call overwrites.
DIAGNOSTICS
Returns NULL (zero) if name is not found.