getttyent

Autres langues

Langue: ja

Version: 2002-07-18 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

名前

getttyent, getttynam, setttyent, endttyent - ttys ファイルのエントリを取得する

書式

#include <ttyent.h>

struct ttyent *getttyent(void);

struct ttyent *getttynam(const char *name);

int setttyent(void);

int endttyent(void);

説明

これらの関数はファイル _PATH_TTYS (例えば /etc/ttys) へのインタフェースを提供する。

関数 setttyent() はファイルをオープンする。 また既にオープンされている場合は、巻き戻す。

関数 endttyent() はファイルをクローズする。

関数 getttynam() は指定された端末名についてファイルを検索する。 この関数は (以下で説明されている) struct ttyent へのポインタを返す。

関数 getttyent() は (もし必要であれば) ファイル _PATH_TTYS をオープンし、 最初のエントリを返す。 ファイルが既にオープンされている場合は、次のエントリを返す。

ttyent 構造体

 struct ttyent {
         char    *ty_name;       /* 端末デバイス名 */
         char    *ty_getty;      /* 実行するコマンド。通常は getty */
         char    *ty_type;       /* termcap のための端末タイプ */
         int     ty_status;      /* 状態フラグ */
         char    *ty_window;     /* ウィンドウマネージャを起動するコマンド */
         char    *ty_comment;    /* コメントフィールド */
 };
 

ty_status は以下のいずれか値をとることができる。

 #define TTY_ON       0x01   /* ログインを有効にする (ty_getty プログラムを開始する) */
 #define TTY_SECURE   0x02   /* ユーザ ID 0 でのログインを許可する */
 

準拠

POSIX.1-2001 にはない。 BSD 系に存在し、おそらく他のシステムにもあるだろう。

注意

Linux では、ファイル /etc/ttys と上で説明した関数は使われていない。

関連項目

ttyname(3), ttyslot(3)