summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/termios/tcsendbreak.347
-rw-r--r--lib/libc/termios/tcsetattr.3160
-rw-r--r--lib/libc/termios/tcsetpgrp.312
3 files changed, 123 insertions, 96 deletions
diff --git a/lib/libc/termios/tcsendbreak.3 b/lib/libc/termios/tcsendbreak.3
index 9a91a724b97..9f59951d2b7 100644
--- a/lib/libc/termios/tcsendbreak.3
+++ b/lib/libc/termios/tcsendbreak.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcsendbreak.3,v 1.4 1999/07/02 16:57:49 aaron Exp $
+.\" $OpenBSD: tcsendbreak.3,v 1.5 1999/07/05 13:09:08 aaron Exp $
.\"
.\" Copyright (c) 1991 The Regents of the University of California.
.\" All rights reserved.
@@ -35,10 +35,10 @@
.Dt TCSENDBREAK 3
.Os
.Sh NAME
-.Nm tcsendbreak ,
.Nm tcdrain ,
+.Nm tcflow ,
.Nm tcflush ,
-.Nm tcflow
+.Nm tcsendbreak
.Nd line control functions
.Sh SYNOPSIS
.Fd #include <termios.h>
@@ -52,13 +52,13 @@
.Fn tcsendbreak "int fd" "int len"
.Sh DESCRIPTION
The
-.Nm tcdrain
+.Fn tcdrain
function waits until all output written to the terminal referenced by
.Fa fd
has been transmitted to the terminal.
.Pp
The
-.Nm tcflow
+.Fn tcflow
function suspends transmission of data to or the reception of data from
the terminal referenced by
.Fa fd
@@ -68,28 +68,31 @@ The value of
.Fa action
must be one of the following:
.Bl -tag -width "TCIOFF"
-.It Fa TCOOFF
+.It Dv TCOOFF
Suspend output.
-.It Fa TCOON
+.It Dv TCOON
Restart suspended output.
-.It Fa TCIOFF
+.It Dv TCIOFF
Transmit a STOP character, which is intended to cause the terminal to stop
transmitting data to the system.
-(See the description of IXOFF in the
+(See the description of
+.Dv IXOFF
+in the
.Ql Input Modes
section of
.Xr termios 4 ).
-.It Fa TCION
+.It Dv TCION
Transmit a START character, which is intended to cause the terminal to start
transmitting data to the system.
-(See the description of IXOFF in the
+(See the description of
+.Dv IXOFF in the
.Ql Input Modes
section of
.Xr termios 4 ).
.El
.Pp
The
-.Nm tcflush
+.Fn tcflush
function discards any data written to the terminal referenced by
.Fa fd
which has not been transmitted to the terminal, or any data received
@@ -99,16 +102,16 @@ The value of
.Fa action
must be one of the following:
.Bl -tag -width "TCIOFLUSH"
-.It Fa TCIFLUSH
+.It Dv TCIFLUSH
Flush data received but not read.
-.It Fa TCOFLUSH
+.It Dv TCOFLUSH
Flush data written but not transmitted.
-.It Fa TCIOFLUSH
+.It Dv TCIOFLUSH
Flush both data received but not read and data written but not transmitted.
.El
.Pp
The
-.Nm tcsendbreak
+.Fn tcsendbreak
function transmits a continuous stream of zero-valued bits for four-tenths
of a second to the terminal referenced by
.Fa fd .
@@ -118,7 +121,7 @@ parameter is ignored in this implementation.
.Sh RETURN VALUES
Upon successful completion, all of these functions return a value of zero.
.Sh ERRORS
-If any error occurs, a value of -1 is returned and the global variable
+If any error occurs, a value of \-1 is returned and the global variable
.Va errno
is set to indicate the error, as follows:
.Bl -tag -width Er
@@ -136,7 +139,7 @@ The file associated with
is not a terminal.
.It Bq Er EINTR
A signal interrupted the
-.Nm tcdrain
+.Fn tcdrain
function.
.El
.Sh SEE ALSO
@@ -144,11 +147,11 @@ function.
.Xr termios 4
.Sh STANDARDS
The
-.Nm tcsendbreak ,
-.Nm tcdrain ,
-.Nm tcflush
+.Fn tcdrain ,
+.Fn tcflow ,
+.Fn tcflush ,
and
-.Nm tcflow
+.Fn tcsendbreak
functions are expected to be compliant with the
.St -p1003.1-88
specification.
diff --git a/lib/libc/termios/tcsetattr.3 b/lib/libc/termios/tcsetattr.3
index e34cc271355..e1e305ba585 100644
--- a/lib/libc/termios/tcsetattr.3
+++ b/lib/libc/termios/tcsetattr.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcsetattr.3,v 1.8 1999/07/02 16:57:49 aaron Exp $
+.\" $OpenBSD: tcsetattr.3,v 1.9 1999/07/05 13:09:08 aaron Exp $
.\"
.\" Copyright (c) 1991 The Regents of the University of California.
.\" All rights reserved.
@@ -64,33 +64,41 @@
.Fn tcsetattr "int fd" "int action" "const struct termios *t"
.Sh DESCRIPTION
The
-.Nm cfmakeraw ,
-.Nm tcgetattr
+.Fn cfmakeraw ,
+.Fn tcgetattr ,
and
-.Nm tcsetattr
-functions are provided for getting and setting the termios structure.
+.Fn tcsetattr
+functions are provided for getting and setting the
+.Li termios
+structure.
.Pp
The
-.Nm cfgetispeed ,
-.Nm cfsetispeed ,
-.Nm cfgetospeed ,
-.Nm cfsetospeed
+.Fn cfgetispeed ,
+.Fn cfsetispeed ,
+.Fn cfgetospeed ,
+.Fn cfsetospeed ,
and
-.Nm cfsetspeed
+.Fn cfsetspeed
functions are provided for getting and setting the baud rate values in
-the termios structure.
+the
+.Li termios
+structure.
The effects of the functions on the terminal as described below
do not become effective, nor are all errors detected, until the
-.Nm tcsetattr
+.Fn tcsetattr
function is called.
-Certain values for baud rates set in the termios structure and passed to
-.Nm tcsetattr
+Certain values for baud rates set in the
+.Li termios
+structure and passed to
+.Fn tcsetattr
have special meanings.
These are discussed in the portion of the manual page that describes the
-.Nm tcsetattr
+.Fn tcsetattr
function.
.Sh GETTING AND SETTING THE BAUD RATE
-The input and output baud rates are found in the termios structure.
+The input and output baud rates are found in the
+.Li termios
+structure.
The unsigned integer
.Li speed_t
is typedef'd in the include file
@@ -121,44 +129,53 @@ represented; however, the following symbolic values are also defined.
.Ed
.Pp
The
-.Nm cfgetispeed
-function returns the input baud rate in the termios structure referenced by
+.Fn cfgetispeed
+function returns the input baud rate in the
+.Li termios
+structure referenced by
.Fa tp .
.Pp
The
-.Nm cfsetispeed
-function sets the input baud rate in the termios structure referenced by
+.Fn cfsetispeed
+function sets the input baud rate in the
+.Li termios
+structure referenced by
.Fa tp
to
.Fa speed .
.Pp
The
-.Nm cfgetospeed
-function returns the output baud rate in the termios structure referenced by
+.Fn cfgetospeed
+function returns the output baud rate in the
+.Li termios
+structure referenced by
.Fa tp .
.Pp
The
-.Nm cfsetospeed
-function sets the output baud rate in the termios structure referenced by
+.Fn cfsetospeed
+function sets the output baud rate in the
+.Li termios
+structure referenced by
.Fa tp
to
.Fa speed .
.Pp
The
-.Nm cfsetspeed
-function sets both the input and output baud rate in the termios structure
-referenced by
+.Fn cfsetspeed
+function sets both the input and output baud rate in the
+.Li termios
+structure referenced by
.Fa tp
to
.Fa speed .
.Pp
Upon successful completion, the functions
-.Nm cfsetispeed ,
-.Nm cfsetospeed ,
+.Fn cfsetispeed ,
+.Fn cfsetospeed ,
and
-.Nm cfsetspeed
+.Fn cfsetspeed
return a value of 0.
-Otherwise, a value of -1 is returned and the global variable
+Otherwise, a value of \-1 is returned and the global variable
.Va errno
is set to indicate the error.
.Sh GETTING AND SETTING THE TERMIOS STATE
@@ -184,37 +201,42 @@ file, not just the open file description associated with the particular
file descriptor.
.Pp
The
-.Nm cfmakeraw
-function sets the flags stored in the termios structure to a state disabling
+.Fn cfmakeraw
+function sets the flags stored in the
+.Li termios
+structure to a state disabling
all input and output processing, giving a
.Dq raw I/O path.
It should be noted that there is no function to reverse this effect.
This is because there are a variety of processing options that could be
re-enabled and the correct method is for an application to snapshot the
current terminal state using the function
-.Nm tcgetattr ,
+.Fn tcgetattr ,
setting raw mode with
-.Nm cfmakeraw
+.Fn cfmakeraw
and the subsequent
-.Nm tcsetattr ,
+.Fn tcsetattr ,
and then using another
-.Nm tcsetattr
+.Fn tcsetattr
with the saved state to revert to the previous terminal state.
.Pp
The
-.Nm tcgetattr
+.Fn tcgetattr
function copies the parameters associated with the terminal referenced
by
.Fa fd
-in the termios structure referenced by
+in the
+.Li termios
+structure referenced by
.Fa tp .
This function is allowed from a background process, although the terminal
attributes may be subsequently changed by a foreground process.
.Pp
The
-.Nm tcsetattr
+.Fn tcsetattr
function sets the parameters associated with the terminal from the
-termios structure referenced by
+.Li termios
+structure referenced by
.Fa tp .
The
.Fa action
@@ -243,40 +265,40 @@ If this value is
into the
.Fa action
value, the values of the
-.Em c_cflag ,
-.Em c_ispeed ,
+.Fa c_cflag ,
+.Fa c_ispeed ,
and
-.Em c_ospeed
+.Fa c_ospeed
fields are ignored.
.El
.Pp
The 0 baud rate is used to terminate the connection.
If 0 is specified as the output speed to the function
-.Nm tcsetattr ,
+.Fn tcsetattr ,
modem control will no longer be asserted on the terminal, disconnecting
the terminal.
.Pp
If zero is specified as the input speed to the function
-.Nm tcsetattr ,
+.Fn tcsetattr ,
the input baud rate will be set to the same value as that specified by
the output baud rate.
.Pp
If
-.Nm tcsetattr
-is unable able to make any of the requested changes, it returns -1 and
-sets
+.Fn tcsetattr
+is unable able to make any of the requested changes, it returns \-1 and
+sets
.Va errno .
Otherwise, it makes all of the requested changes it can.
If the specified input and output baud rates differ and are a combination
that is not supported, neither baud rate is changed.
.Pp
Upon successful completion, the functions
-.Nm tcgetattr
+.Fn tcgetattr
and
-.Nm tcsetattr
+.Fn tcsetattr
return a value of 0.
Otherwise, they
-return -1 and the global variable
+return \-1 and the global variable
.Va errno
is set to indicate the error, as follows:
.Bl -tag -width Er
@@ -284,28 +306,30 @@ is set to indicate the error, as follows:
The
.Fa fd
argument to
-.Nm tcgetattr
+.Fn tcgetattr
or
-.Nm tcsetattr
+.Fn tcsetattr
was not a valid file descriptor.
.It Bq Er EINTR
The
-.Nm tcsetattr
+.Fn tcsetattr
function was interrupted by a signal.
.It Bq Er EINVAL
The
.Fa action
argument to the
-.Nm tcsetattr
+.Fn tcsetattr
function was not valid, or an attempt was made to change an attribute
-represented in the termios structure to an unsupported value.
+represented in the
+.Li termios
+structure to an unsupported value.
.It Bq Er ENOTTY
The file associated with the
.Fa fd
argument to
-.Nm tcgetattr
+.Fn tcgetattr
or
-.Nm tcsetattr
+.Fn tcsetattr
is not a terminal.
.El
.Sh SEE ALSO
@@ -313,25 +337,25 @@ is not a terminal.
.Xr termios 4
.Sh STANDARDS
The
-.Nm cfgetispeed ,
-.Nm cfsetispeed ,
-.Nm cfgetospeed ,
-.Nm cfsetospeed ,
-.Nm tcgetattr
+.Fn cfgetispeed ,
+.Fn cfsetispeed ,
+.Fn cfgetospeed ,
+.Fn cfsetospeed ,
+.Fn tcgetattr ,
and
-.Nm tcsetattr
+.Fn tcsetattr
functions are expected to be compliant with the
.St -p1003.1-88
specification.
The
-.Nm cfmakeraw
+.Fn cfmakeraw
and
-.Nm cfsetspeed
+.Fn cfsetspeed
functions,
as well as the
.Dv TCSASOFT
option to the
-.Nm tcsetattr
+.Fn tcsetattr
function are extensions to the
.St -p1003.1-88
specification.
diff --git a/lib/libc/termios/tcsetpgrp.3 b/lib/libc/termios/tcsetpgrp.3
index 50c2ef26c39..232b5238f28 100644
--- a/lib/libc/termios/tcsetpgrp.3
+++ b/lib/libc/termios/tcsetpgrp.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tcsetpgrp.3,v 1.6 1999/07/02 16:57:49 aaron Exp $
+.\" $OpenBSD: tcsetpgrp.3,v 1.7 1999/07/05 13:09:08 aaron Exp $
.\"
.\" Copyright (c) 1991 The Regents of the University of California.
.\" All rights reserved.
@@ -44,7 +44,7 @@
.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
.Sh DESCRIPTION
If the process has a controlling terminal, the
-.Nm tcsetpgrp
+.Fn tcsetpgrp
function sets the foreground process group ID associated with the
terminal device to
.Fa pgrp_id .
@@ -59,12 +59,12 @@ must be the same as the process group ID of a process in the same
session as the calling process.
.Pp
Upon successful completion,
-.Nm tcsetpgrp
+.Fn tcsetpgrp
returns a value of zero.
.Sh ERRORS
If an error occurs,
-.Nm tcgetpgrp
-returns -1 and the global variable
+.Fn tcgetpgrp
+returns \-1 and the global variable
.Va errno
is set to indicate the error, as follows:
.Bl -tag -width Er
@@ -94,7 +94,7 @@ session as the calling process.
.Xr tcgetpgrp 3
.Sh STANDARDS
The
-.Nm tcsetpgrp
+.Fn tcsetpgrp
function is expected to be compliant with the
.St -p1003.1-88
specification.