2.9BSD/usr/man/cat3/getlogin.3

Compare this file to the similar file:
Show the results in this format:


GETLOGIN(3)         UNIX Programmer's Manual          GETLOGIN(3)

NAME
     getlogin - get login name

SYNOPSIS
     char *getlogin();

DESCRIPTION
     _G_e_t_l_o_g_i_n returns a pointer to the login name as found in
     /_e_t_c/_u_t_m_p.  It may be used in conjunction with _g_e_t_p_w_n_a_m to
     locate the correct password file entry when the same userid
     is shared by several login names.

     If _g_e_t_l_o_g_i_n is called within a process that is not attached
     to a typewriter, it returns NULL.

FILES
     /etc/utmp

SEE ALSO
     getpwent(3), getgrent(3), utmp(5)

DIAGNOSTICS
     Returns NULL if name not found.

BUGS
     The return values point to static data whose contents are
     overwritten by each call.  _G_e_t_l_o_g_i_n is almost useless.  It
     attempts to determine the user name by first determining
     whether file descriptors 0, 1, or 2 are attached to ttys.
     If so, /etc/utmp is used to associate a user name.  The
     deficiencies of this method are clear.  _G_e_t_l_o_g_i_n should
     never be used when security is a consideration.

Printed 6/29/83                                                 1