login,
LOGIN(N)           Linux System Administration           LOGIN(N)



NAME
       login, logout - user accounting functions

SYNOPSIS
       #include <utmp.h>

       void login(const struct utmp *entry);
       int logout(const char *ut_line);

DESCRIPTION
       The  function  login()  inserts  a new entry into the user
       accounting database (utmp file).  The element  ut->ut_line
       will be set to the name of the terminal on standard input.
       If this is not a terminal, login() will use  the  standard
       output  or  standard error output to determine the name of
       the terminal.  The element  ut->ut_type  will  be  set  to
       USER_PROCESS,  ut->ut_pid will be set to the process id of
       the calling  process.   All  remaining  elements  will  be
       copied from entry.

       A  copy  of  the  resulting  entry  is written to the user
       accounting log file.

       The  logout()  function  modifies  the   user   accounting
       database to indicate that the user on terminal ut_line has
       logged out.

RETURN VALUES
       The logout() function returns 1 if the entry was  success-
       fully  written to the database, or 0 if an error occurred.

NOTE
       These functions are included in libutil, hence you'll need
       to add ``-lutil'' to your compiler commandline.

       Note  that  the  member  ut_user  of struct utmp is called
       ut_name in BSD.  Therefore, ut_name is defined as an alias
       for ut_user in utmp.h.

FILES
       /var/run/utmp
              user   accounting   database,   configured  through
              _PATH_UTMP in <paths.h>

SEE ALSO
       utmp(p), getutent(t)



GNU/Linux                   2002-01-28                   LOGIN(N)