[BACK]Return to getttyent.3 CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Annotation of src/lib/libc/gen/getttyent.3, Revision 1.11.12.3

1.11.12.3! nathanw     1: .\"    $NetBSD$
1.6       cgd         2: .\"
                      3: .\" Copyright (c) 1989, 1991, 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
1.1       cgd         5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
                     14: .\" 3. All advertising materials mentioning features or use of this software
                     15: .\"    must display the following acknowledgement:
                     16: .\"    This product includes software developed by the University of
                     17: .\"    California, Berkeley and its contributors.
                     18: .\" 4. Neither the name of the University nor the names of its contributors
                     19: .\"    may be used to endorse or promote products derived from this software
                     20: .\"    without specific prior written permission.
                     21: .\"
                     22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     25: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     32: .\" SUCH DAMAGE.
                     33: .\"
1.6       cgd        34: .\"     @(#)getttyent.3        8.1 (Berkeley) 6/4/93
1.1       cgd        35: .\"
1.6       cgd        36: .Dd June 4, 1993
1.1       cgd        37: .Dt GETTTYENT 3
1.11      garbled    38: .Os
1.1       cgd        39: .Sh NAME
                     40: .Nm getttyent ,
                     41: .Nm getttynam ,
                     42: .Nm setttyent ,
                     43: .Nm endttyent
                     44: .Nd get ttys file entry
1.9       perry      45: .Sh LIBRARY
                     46: .Lb libc
1.1       cgd        47: .Sh SYNOPSIS
1.11.12.1  nathanw    48: .Fd #include \*[Lt]ttyent.h\*[Gt]
1.1       cgd        49: .Ft struct ttyent *
                     50: .Fn getttyent
                     51: .Ft struct ttyent *
                     52: .Fn getttynam "char *name"
                     53: .Ft int
                     54: .Fn setttyent void
                     55: .Ft int
                     56: .Fn endttyent void
                     57: .Sh DESCRIPTION
                     58: The
                     59: .Fn getttyent ,
                     60: and
                     61: .Fn getttynam
                     62: functions
                     63: each return a pointer to an object, with the following structure,
                     64: containing the broken-out fields of a line from the tty description
                     65: file.
                     66: .Bd -literal
                     67: struct ttyent {
                     68:        char    *ty_name;       /* terminal device name */
                     69:        char    *ty_getty;      /* command to execute */
                     70:        char    *ty_type;       /* terminal type */
                     71: #define        TTY_ON          0x01    /* enable logins */
                     72: #define        TTY_SECURE      0x02    /* allow uid of 0 to login */
1.3       cgd        73: #define        TTY_LOCAL       0x04    /* set 'CLOCAL' on open (dev. specific) */
                     74: #define        TTY_RTSCTS      0x08    /* set 'CRTSCTS' on open (dev. specific) */
                     75: #define        TTY_SOFTCAR     0x10    /* ignore hardware carrier (dev. spec.) */
1.4       cgd        76: #define        TTY_MDMBUF      0x20    /* set 'MDMBUF' on open (dev. specific) */
1.8       scottr     77: #define        TTY_DTRCTS      0x40    /* set 'CDTRCTS' on open (dev. specific) */
1.1       cgd        78:        int     ty_status;      /* flag values */
                     79:        char    *ty_window;     /* command for window manager */
                     80:        char    *ty_comment;    /* comment field */
1.10      tsarna     81:        char    *ty_class;      /* category of tty usage */
1.1       cgd        82: };
                     83: .Ed
                     84: .Pp
                     85: The fields are as follows:
                     86: .Bl -tag -width ty_comment
                     87: .It Fa ty_name
                     88: The name of the character-special file.
                     89: .It Fa ty_getty
                     90: The name of the command invoked by
                     91: .Xr init 8
                     92: to initialize tty line characteristics.
                     93: .It Fa ty_type
                     94: The name of the default terminal type connected to this tty line.
                     95: .It Fa ty_status
                     96: A mask of bit fields which indicate various actions allowed on this
                     97: tty line.
                     98: The possible flags are as follows:
1.3       cgd        99: .Bl -tag -width TTY_SOFTCAR
1.1       cgd       100: .It Dv TTY_ON
                    101: Enables logins (i.e.,
                    102: .Xr init 8
                    103: will start the command referenced by
                    104: .Fa ty_getty
                    105: on this entry).
                    106: .It Dv TTY_SECURE
                    107: Allow users with a uid of 0 to login on this terminal.
1.3       cgd       108: .It Dv TTY_LOCAL
                    109: If the terminal port's driver supports it, cause the line
                    110: to be treated as ``local.''
1.7       christos  111: .It Dv TTY_MDMBUF
                    112: If the terminal port's driver supports it, use
                    113: DTR/DCD hardware flow control on the line by default.
1.3       cgd       114: .It Dv TTY_RTSCTS
                    115: If the terminal port's driver supports it, use
                    116: full-duplex RTS/CTS hardware flow control on the line
                    117: by default.
                    118: .It Dv TTY_SOFTCAR
                    119: If the terminal port's driver supports it, ignore hardware
                    120: carrier on the line.
1.1       cgd       121: .El
                    122: .It Fa ty_window
                    123: The command to execute for a window system associated with the line.
                    124: .It Fa ty_comment
                    125: Any trailing comment field, with any leading hash marks (``#'') or
                    126: whitespace removed.
1.10      tsarna    127: .It Fa ty_class
                    128: A key indexing into a termcap-style database (/etc/ttyclasses)
1.11.12.3! nathanw   129: of attributes for this class of tty.
        !           130: No attributes are currently defined or used,
        !           131: so there are currently no functions to retrieve them.
1.1       cgd       132: .El
                    133: .Pp
                    134: If any of the fields pointing to character strings are unspecified,
                    135: they are returned as null pointers.
                    136: The field
                    137: .Fa ty_status
                    138: will be zero if no flag values are specified.
                    139: .Pp
                    140: See
                    141: .Xr ttys 5
                    142: for a more complete discussion of the meaning and usage of the
                    143: fields.
                    144: .Pp
                    145: The
                    146: .Fn getttyent
                    147: function
                    148: reads the next line from the ttys file, opening the file if necessary.
                    149: The
                    150: .Fn setttyent
                    151: function
                    152: rewinds the file if open, or opens the file if it is unopened.
                    153: The
                    154: .Fn endttyent
                    155: function
                    156: closes any open files.
                    157: .Pp
                    158: The
                    159: .Fn getttynam
                    160: function
                    161: searches from the beginning of the file until a matching
                    162: .Fa name
                    163: is found
                    164: (or until
                    165: .Dv EOF
                    166: is encountered).
                    167: .Sh RETURN VALUES
                    168: The routines
                    169: .Fn getttyent
                    170: and
                    171: .Fn getttynam
                    172: return a null pointer on
                    173: .Dv EOF
                    174: or error.
                    175: The
                    176: .Fn setttyent
                    177: function
                    178: and
                    179: .Fn endttyent
                    180: return 0 on failure and 1 on success.
                    181: .Sh FILES
                    182: .Bl -tag -width /etc/ttys -compact
                    183: .It Pa /etc/ttys
                    184: .El
                    185: .Sh SEE ALSO
                    186: .Xr login 1 ,
                    187: .Xr ttyslot 3 ,
                    188: .Xr gettytab 5 ,
                    189: .Xr termcap 5 ,
                    190: .Xr ttys 5 ,
                    191: .Xr getty 8 ,
1.3       cgd       192: .Xr init 8 ,
                    193: .Xr ttyflags 8
1.1       cgd       194: .Sh HISTORY
                    195: The
                    196: .Fn getttyent ,
                    197: .Fn getttynam ,
                    198: .Fn setttyent ,
                    199: and
                    200: .Fn endttyent
                    201: functions appeared in
                    202: .Bx 4.3 .
                    203: .Sh BUGS
                    204: These functions use static data storage;
                    205: if the data is needed for future use, it should be
                    206: copied before any subsequent calls overwrite it.

CVSweb <webmaster@jp.NetBSD.org>