logout -- logout utility function


#include <utmp.h>

int logout (const char * line );


Given the device line, the logout() function shall search the user accounting database which is read by getutent() for an entry with the corresponding line, and with the type of USER_PROCESS. If a corresponding entry is located, it shall be updated as follows:

  1. The ut_name field shall be set to zeroes (UT_NAMESIZE NUL bytes).

  2. The ut_host field shall be set to zeroes (UT_HOSTSIZE NUL bytes).

  3. The ut_tv shall be set to the current time of day.

  4. The ut_type field shall be set to DEAD_PROCESS.

Return Value

On success, the logout() function shall return non-zero. Zero is returned if there was no entry to remove, or if the utmp file could not be opened or updated.