ttyslot - find the slot of the current user in the user accounting database (LEGACY)
#include <stdlib.h> int ttyslot(void);
The ttyslot() function returns the index of the current user's entry in the user accounting database. The current user's entry is an entry for which the utline member matches the name of a terminal device associated with any of the process' file descriptors 0, 1 or 2. The index is an ordinal number representing the record number in the database of the current user's entry. The first entry in the database is represented by the return value 0.
This interface need not be reentrant.
Upon successful completion, ttyslot() returns the index of the current user's entry in the user accounting database. The ttyslot() function returns -1 if an error was encountered while searching the database or if none of file descriptors 0, 1 or 2 is associated with a terminal device.
No errors are defined.
endutxent(), ttyname(), <stdlib.h>.