GETLOGIN(S) UNIX System V GETLOGIN(S)
Name
getlogin - get login name
Syntax
char *getlogin ( );
Description
The getlogin function returns a pointer to the login name as
found in /etc/utmp. It may be used in conjunction with
getpwnam to locate the correct password file entry when the
same user ID is shared by several login names.
If getlogin 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 cuserid,
or to call getlogin and if it fails, to call getpwuid.
Files
/etc/utmp
See Also
cuserid(S), getgrent(S), getpwent(S), utmp(F)
Diagnostics
Returns the NULL pointer if name is not found.
Note
The return values point to static data whose content is
overwritten by each call.
Standards Conformance
getlogin is conformant with:
AT&T SVID Issue 2, Select Code 307-127;
The X/Open Portability Guide II of January 1987;
IEEE POSIX Std 1003.1-1988 with C Standard Language-
Dependent System Support;
and NIST FIPS 151-1.
(printed 6/20/89)