login -- login utility function


#include <utmp.h>

void login (struct utmp * ut );


The login() function shall update the user accounting databases. The ut parameter shall reference a utmp structure for all fields except the following:

  1. The ut_type field shall be set to USER_PROCESS.

  2. The ut_pid field shall be set to the process identifier for the current process.

  3. The ut_line field shall be set to the name of the controlling terminal device. The name shall be found by examining the device associated with the standard input, output and error streams in sequence, until one associated with a terminal device is found. If none of these streams refers to a terminal device, the ut_line field shall be set to "???". If the terminal device is in the /dev directory hierarchy, the ut_line field shall not contain the leading "/dev/", otherwise it shall be set to the final component of the pathname of the device. If the user accounting database imposes a limit on the size of the ut_line field, it shall truncate the name, but any such limit shall not be smaller than UT_LINESIZE (including a terminating null character).

Return Value