getlogin(3) CLIX getlogin(3)
NAME
getlogin - Gets the user's login name
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
char *getlogin(
void );
DESCRIPTION
The getlogin() function returns a pointer to the login name as found in
the /etc/utmp file. The getlogin() function 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 getlogin(), and if
either fails, call getpwuid().
FILES
/etc/utmp Holds user and accounting information for login.
NOTES
The getlogin() function returns a pointer to a static area that is
overwritten by successive calls.
RETURN VALUES
The getlogin() function returns a pointer to a string containing the
user's login name. If the login name is not found, a NULL pointer is
returned.
RELATED INFORMATION
Functions: cuserid(3), getgrent(3), getgrgid(3), getgrnam(3),
setgrent(3), endgrent(3), getpwent(3), getpwuid(3), setpwent(3),
endpwent(3), setpwfile(3)
Files: utmp(4)
2/94 - Intergraph Corporation 1