1*61111Sbostic.\" Copyright (c) 1989, 1991, 1993 2*61111Sbostic.\" The Regents of the University of California. All rights reserved. 320618Smckusick.\" 443571Strent.\" %sccs.include.redist.man% 520618Smckusick.\" 6*61111Sbostic.\" @(#)getttyent.3 8.1 (Berkeley) 06/04/93 739176Sbostic.\" 848352Scael.Dd 948352Scael.Dt GETTTYENT 3 1048352Scael.Os BSD 4.3 1148352Scael.Sh NAME 1248352Scael.Nm getttyent , 1348352Scael.Nm getttynam , 1448352Scael.Nm setttyent , 1548352Scael.Nm endttyent 1648352Scael.Nd get ttys file entry 1748352Scael.Sh SYNOPSIS 1848352Scael.Fd #include <ttyent.h> 1948352Scael.Ft struct ttyent * 2048352Scael.Fn getttyent 2148352Scael.Ft struct ttyent * 2248352Scael.Fn getttynam "char *name" 2348352Scael.Ft int 2448352Scael.Fn setttyent void 2548352Scael.Ft int 2648352Scael.Fn endttyent void 2748352Scael.Sh DESCRIPTION 2848352ScaelThe 2948352Scael.Fn getttyent , 3020618Smckusickand 3148352Scael.Fn getttynam 3248352Scaelfunctions 3339176Sbosticeach return a pointer to an object, with the following structure, 3439176Sbosticcontaining the broken-out fields of a line from the tty description 3539176Sbosticfile. 3648352Scael.Bd -literal 3739176Sbosticstruct ttyent { 3848352Scael char *ty_name; /* terminal device name */ 3948352Scael char *ty_getty; /* command to execute */ 4048352Scael char *ty_type; /* terminal type */ 4139176Sbostic#define TTY_ON 0x01 /* enable logins */ 4239176Sbostic#define TTY_SECURE 0x02 /* allow uid of 0 to login */ 4348352Scael int ty_status; /* flag values */ 4448352Scael char *ty_window; /* command for window manager */ 4548352Scael char *ty_comment; /* comment field */ 4639176Sbostic}; 4748352Scael.Ed 4848352Scael.Pp 4939176SbosticThe fields are as follows: 5048352Scael.Bl -tag -width ty_comment 5148352Scael.It Fa ty_name 5239176SbosticThe name of the character-special file. 5348352Scael.It Fa ty_getty 5439176SbosticThe name of the command invoked by 5548352Scael.Xr init 8 5620618Smckusickto initialize tty line characteristics. 5748352Scael.It Fa ty_type 5839176SbosticThe name of the default terminal type connected to this tty line. 5948352Scael.It Fa ty_status 6039176SbosticA mask of bit fields which indicate various actions allowed on this 6139176Sbostictty line. 6239176SbosticThe possible flags are as follows: 6348352Scael.Bl -tag -width TTY_SECURE 6448352Scael.It Dv TTY_ON 6528313SkarelsEnables logins (i.e., 6648352Scael.Xr init 8 6739176Sbosticwill start the command referenced by 6848352Scael.Fa ty_getty 6928313Skarelson this entry). 7048352Scael.It Dv TTY_SECURE 7139176SbosticAllow users with a uid of 0 to login on this terminal. 7248352Scael.El 7348352Scael.It Fa ty_window 7439176SbosticThe command to execute for a window system associated with the line. 7548352Scael.It Fa ty_comment 7639176SbosticAny trailing comment field, with any leading hash marks (``#'') or 7739176Sbosticwhitespace removed. 7848352Scael.El 7948352Scael.Pp 8039176SbosticIf any of the fields pointing to character strings are unspecified, 8139176Sbosticthey are returned as null pointers. 8239176SbosticThe field 8348352Scael.Fa ty_status 8439176Sbosticwill be zero if no flag values are specified. 8548352Scael.Pp 8639176SbosticSee 8748352Scael.Xr ttys 5 8839176Sbosticfor a more complete discussion of the meaning and usage of the 8939176Sbosticfields. 9048352Scael.Pp 9148352ScaelThe 9248352Scael.Fn getttyent 9348352Scaelfunction 9439176Sbosticreads the next line from the ttys file, opening the file if necessary. 9548352ScaelThe 9648352Scael.Fn setttyent 9748352Scaelfunction 9839176Sbosticrewinds the file if open, or opens the file if it is unopened. 9948352ScaelThe 10048352Scael.Fn endttyent 10148352Scaelfunction 10239176Sbosticcloses any open files. 10348352Scael.Pp 10448352ScaelThe 10548352Scael.Fn getttynam 10648352Scaelfunction 10720618Smckusicksearches from the beginning of the file until a matching 10848352Scael.Fa name 10920618Smckusickis found 11048352Scael(or until 11148352Scael.Dv EOF 11248352Scaelis encountered). 11348352Scael.Sh RETURN VALUES 11439176SbosticThe routines 11548352Scael.Fn getttyent 11639176Sbosticand 11748352Scael.Fn getttynam 11848352Scaelreturn a null pointer on 11948352Scael.Dv EOF 12048352Scaelor error. 12148352ScaelThe 12248352Scael.Fn setttyent 12348352Scaelfunction 12439176Sbosticand 12548352Scael.Fn endttyent 12639176Sbosticreturn 0 on failure and 1 on success. 12748352Scael.Sh FILES 12848352Scael.Bl -tag -width /etc/ttys -compact 12948352Scael.It Pa /etc/ttys 13048352Scael.El 13148352Scael.Sh SEE ALSO 13248352Scael.Xr login 1 , 13348352Scael.Xr ttyslot 3 , 13448352Scael.Xr gettytab 5 , 13548352Scael.Xr termcap 5 , 13648352Scael.Xr ttys 5 , 13748352Scael.Xr getty 8 , 13848352Scael.Xr init 8 13948352Scael.Sh HISTORY 14048352ScaelThe 14148352Scael.Fn getttyent , 14248352Scael.Fn getttynam , 14348352Scael.Fn setttyent , 14448352Scaeland 14548352Scael.Fn endttyent 14648352Scaelfunctions appeared in 14748352Scael.Bx 4.3 . 14848352Scael.Sh BUGS 14948352ScaelThese functions use static data storage; 15048352Scaelif the data is needed for future use, it should be 15148352Scaelcopied before any subsequent calls overwrite it. 152