[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

ttyslot Subroutine

Purpose

Finds the slot in the utmp file for the current user.

Library

Standard C Library (libc.a)

Syntax

#include <stdlib.h>
int ttyslot (void)

Description

The ttyslot subroutine returns the index of the current user's entry in the /etc/utmp file. The ttyslot subroutine scans the /etc/utmp file for the name of the terminal associated with the standard input, the standard output, or the error output file descriptors (0, 1, or 2).

The ttyslot subroutine returns -1 if an error is encountered while searching for the terminal name, or if none of the first three file descriptors (0, 1, and 2) is associated with a terminal device.

Files

/etc/inittab The path to the inittab file, which controls the initialization process.
/etc/utmp The path to the utmp file, which contains a record of users logged in to the system.

Related Information

The getutent subroutine, ttyname or isatty (ttyname or isatty Subroutine) subroutine.

The Input and Output Handling Programmer's Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]