getttyent.3

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 154 行

3
154
字号
.\" SCCSID: @(#)getttyent.3	3.1	11/24/87.TH getttyent 3.SH Namegetttyent, getttynam, setttyent, endttyent \- get ttys file entry .SH Syntax#include <ttyent.h>.brstruct ttyent *getttyent().brstruct ttyent *getttynam(\fIname\fR) char *\fIname;\fR.brvoid setttyent().brvoid endttyent() .SH Arguments.TP\fIname\fPThe name of the terminal's special file in the .PN /devdirectory..SH Description.NXR "getttyent subroutine".NXR "getttynam subroutine".NXR "settyent subroutine".NXR "endttyent subroutine".NXR "ttys file" "accessing data"These functions allow a program to access data in thefile .PN /etc/ttys .The.PN getttyentfunction reads the .PN /etc/ttysfile line by line, opening the file ifnecessary..PN setttyent rewinds the file, and.PN endttyentcloses it..PN getttynamsearches from the beginning of the file until a matching nameis found, or until end-of-file is encountered..PPThe functions .PN getttyentand .PN getttynameach return a pointer to an objectthat has the following structure. Each element of the structure containsone field of a line in the .PN /etc/ttysfile..EX 0struct ttyent {         /* see getttyent(3) */       char *ty_name;   /* terminal device name */       char *ty_getty;  /* command to execute, usually getty */       char *ty_type;   /* terminal type for termcap (3x) */       int  ty_status;  /* status flags (see below for defines) */       char *ty_window; /* command to start up window manager */       char *ty_comment;/* usually the location of the terminal */       };#define TTY_ON      0x1  /* enable logins (startup getty) */#define TTY_SECURE  0x2  /* allow root to login */#define TTY_LOCAL   0x4  /* line is local direct connect and                         should ignore modem signals */#define TTY_SHARED  0x8  /* line is shared:  it can be use                         for both incoming and outgoing                         connections. */#define TTY_TRACK   0x10 /* track modem status changes */#define TTY_TERMIO  0x20 /* open line with termio defaults */#define TTY_SU      0x40 /* disallow su to root */   extern struct ttyent *getttyent();extern struct ttyent *getttynam();.EEA description of the fields follows:.NXR "ttys file" "field definitions".IP ty_nameis the name of the terminal's special file inthe directory .PN /dev ..IP ty_gettyis the command invoked by .PN initto initialize terminal line characteristics.This command is usually.MS getty 8 ,but any arbitrary command  canbe  used.  A typical use is to initiate a terminalemulator in a window system..IP ty_typeis the name of the default terminal type  connectedto this tty line.  This is typically aname from the .MS termcap 5 data base.  Theenvironment variable `TERM' is initialized withthis name by .MS login 1 ..IP ty_statusis a mask of bit flags that indicate  variousactions allowed on this terminal line. Thefollowing is a description of each flag..RS.IP TTY_ONEnables logins.  For instance, .MS init 8will start the specified .PN gettycommand on this entry..IP TTY_SECURE Allows root to login on this  terminal.  TTY_ON mustalso beincluded for this to work..IP TTY_LOCALIndicates that the line is to ignore modem signals.  .IP TTY_SHAREDIndicates that the line can be used for both incomingand outgoing connections..IP TTY_TERMIOIndicates that a line is to be opened with defaultterminal attributes which are compliant with SystemFive termio defaults.  The line discipline will be setto be TERMIODISC..IP TTY_SUIndicates that a user is allowed to su to root on this terminal.The default if this flag is not set is that a user cannot su to rooton this terminal..RE.IP ty_windowis the quoted string of a command to executefor a window system associated with the line.If no command is specified, this field is a nullstring..IP ty_commentCurrently unused. .SH Restrictions.NXR "getttyent subroutine" "restrictions".PPThe information returned is in a static area, soyou must copy it to save it.  .SH Return Values.PPA null pointer (0) is returned on an end-of-fileor error..SH Files.PN /etc/ttys The file examined by these routines. .SH See Alsottyname(3), ttys(5), init(8)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?