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

Technical Reference: Base Operating System and Extensions, Volume 1


getttyent, getttynam, setttyent, or endttyent Subroutine

Purpose

Gets a tty description file entry.

Library

Standard C Library (libc.a)

Syntax

#include <ttyent.h>


struct ttyent *getttyent()
struct ttyent *getttynam( Name)
char *Name;
void setttyent()
void endttyent()

Description

Attention: Do not use the getttyent, getttynam, setttyent, or endttyent subroutine in a multithreaded environment.

The getttyent and getttynam subroutines each return a pointer to an object with the ttyent structure. This structure contains the broken-out fields of a line from the tty description file. The ttyent structure is in the /usr/include/sys/ttyent.h file and contains the following fields:

tty_name The name of the character special file in the /dev directory. The character special file must reside in the /dev directory.
ty_getty The command that is called by the init process to initialize tty line characteristics. This is usually the getty command, but any arbitrary command can be used. A typical use is to initiate a terminal emulator in a window system.
ty_type The name of the default terminal type connected to this tty line. This is typically a name from the termcap database. The TERM environment variable is initialized with this name by the getty or login command.
ty_status A mask of bit fields that indicate various actions to be allowed on this tty line. The following is a description of each flag:

TTY_ON
Enables logins (that is, the init process starts the specified getty command on this entry).

TTY_SECURE
Allows a user with root user authority to log in to this terminal. The TTY_ON flag must be included.
ty_window The command to execute for a window system associated with the line. The window system is started before the command specified in the ty_getty field is executed. If none is specified, this is null.
ty_comment The trailing comment field. A leading delimiter and white space is removed.

The getttyent subroutine reads the next line from the tty file, opening the file if necessary. The setttyent subroutine rewinds the file. The endttyent subroutine closes it.

The getttynam subroutine searches from the beginning of the file until a matching name (specified by the Name parameter) is found (or until the EOF is encountered).

Parameters


Name Specifies the name of a tty description file.

Return Values

These subroutines return a null pointer when they encounter an EOF (end-of-file) character or an error.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Files


/usr/lib/libodm.a Specifies the ODM (Object Data Manager) library.
/usr/lib/libcfg.a Archives device configuration subroutines.
/etc/termcap Defines terminal capabilities.

Related Information

The ttyslot subroutine.

The getty command, init command, login command.

List of Files and Directories Subroutines in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


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