components/libtecla/files/gl_io_mode.3tecla
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Wed, 29 Aug 2012 11:05:56 -0700
changeset 957 255465c5756f
parent 681 7c568e880861
child 5810 76203f2cf39d
permissions -rw-r--r--
Close of build 04.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
681
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
'\" te
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
.\" Copyright (c) 2000, 2001, 2002, 2003, 2004 by Martin C. Shepherd. All Rights Reserved.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
.\" Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.  Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
.TH gl_io_mode 3TECLA "1 Jun 2004" "SunOS 5.11" "Interactive Command-line Input Library Functions"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
.SH NAME
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
gl_io_mode, gl_raw_io, gl_normal_io, gl_tty_signals, gl_abandon_line, gl_handle_signal, gl_pending_io \- use \fBgl_get_line()\fR from an external event loop
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
.SH SYNOPSIS
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-ltecla\fR [ \fIlibrary\fR\&.\|.\|. ] 
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
#include <libtecla.h>
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    14
\fBint\fR \fBgl_io_mode\fR(\fBGetLine *\fR\fIgl\fR, \fBGlIOMode\fR \fImode\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    15
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    16
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    17
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    19
\fBint\fR \fBgl_raw_io\fR(\fBGetLine *\fR\fIgl\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    22
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
\fBint\fR \fBgl_normal_io\fR(\fBGetLine *\fR\fIgl\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
\fBint\fR \fBgl_tty_signals\fR(\fBvoid (*\fR\fIterm_handler\fR)(int), \fBvoid (*\fR\fIsusp_handler\fR)(int),
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    30
     \fBvoid (*\fR\fIcont_handler\fR)(int), \fBvoid (*\fR\fIsize_handler\fR)(int));
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    33
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    35
\fBvoid\fR \fBgl_abandon_line\fR(\fBGetLine *\fR\fIgl\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    36
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    37
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    38
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40
\fBvoid\fR \fBgl_handle_signal\fR(\fBint\fR \fIsigno\fR, \fBGetLine *\fR\fIgl\fR, \fBint\fR \fIngl\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    41
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    42
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    43
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    44
.nf
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    45
\fBGlPendingIO\fR \fBgl_pending_io\fR(\fBGetLine *\fR\fIgl\fR);
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    46
.fi
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    47
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    48
.SH DESCRIPTION
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    49
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    50
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    51
The \fBgl_get_line\fR(3TECLA) function supports two different I/O modes. These are selected by calling the \fBgl_io_mode()\fR function. The \fImode\fR argument of \fBgl_io_mode()\fR specifies the new I/O mode and must be one of the following.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    52
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    53
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    54
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    55
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    56
\fB\fBGL_NORMAL_MODE\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    57
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    58
.RS 18n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    59
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    60
Select the normal blocking-I/O mode. In this mode \fBgl_get_line()\fR does not return until either an error occurs of the user finishes entering a new line.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    61
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    62
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    63
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    64
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    65
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    66
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    67
\fB\fBGL_SERVER_MODE\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    68
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    69
.RS 18n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    70
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    71
Select non-blocking server I/O mode. In this mode, since non-blocking terminal I/O is used, the entry of each new input line typically requires many calls to \fBgl_get_line()\fR from an external I/O-driven event loop.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    72
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    73
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    74
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    75
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    76
Newly created GetLine objects start in normal I/O mode, so to switch to non-blocking server mode requires an initial call to \fBgl_io_mode()\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    77
.SS "Server I/O Mode"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    78
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    79
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    80
In non-blocking server I/O mode, the application is required to have an event loop that calls \fBgl_get_line()\fR whenever the terminal file descriptor can perform the type I/O that \fBgl_get_line()\fR is waiting for. To determine which type of I/O \fBgl_get_line()\fR is waiting for, the application calls the \fBgl_pending_io()\fR function.  The return value is one of the following two enumerated values.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    81
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    82
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    83
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    84
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    85
\fB\fBGLP_READ\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    86
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    87
.RS 13n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    88
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    89
\fBgl_get_line()\fR is waiting to write a character to the terminal.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    90
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    91
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    92
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    93
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    94
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    95
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    96
\fB\fBGLP_WRITE\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    97
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    98
.RS 13n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    99
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   100
\fBgl_get_line()\fR is waiting to read a character from the keyboad.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   101
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   102
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   103
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   104
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   105
If the application is using either the \fBselect\fR(3C) or \fBpoll\fR(2) function to watch for I/O on a group of file descriptors, then it should call the \fBgl_pending_io()\fR function before each call to these functions to determine which direction of I/O it should tell them to watch for, and configure their arguments accordingly. In the case of the \fBselect()\fR function, this means using the \fBFD_SET()\fR macro to add the terminal file descriptor either to the set of file descriptors to be watched for readability or the set to be watched for writability.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   106
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   107
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   108
As in normal I/O mode, the return value of \fBgl_get_line()\fR is either a pointer to a completed input line or \fINULL\fR. However, whereas in normal I/O mode a \fINULL\fR return value always means that an error occurred, in non-blocking server mode, \fINULL\fR is also returned when \fBgl_get_line()\fR cannot read or write to the terminal without blocking. Thus in non-blocking server mode, in order to determine when a \fINULL\fR return value signifies that an error occurred or not, it is necessary to call the \fBgl_return_status()\fR function. If this function returns the enumerated value \fBGLR_BLOCKED\fR, \fBgl_get_line()\fR is waiting for I/O and no error has occurred.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   109
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   110
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   111
When \fBgl_get_line()\fR returns \fINULL\fR and \fBgl_return_status()\fR indicates that this is due to blocked terminal I/O, the application should call \fBgl_get_line()\fR again when the type of I/O reported by \fBgl_pending_io()\fR becomes possible. The \fIprompt\fR, \fIstart_line\fR and \fIstart_pos\fR arguments of \fBgl_get_line()\fR will be ignored on these calls. If you need to change the prompt of the line that is currently being edited, you can call the \fBgl_replace_prompt\fR(3TECLA) function between calls to \fBgl_get_line()\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   112
.SS "Giving Up The Terminal"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   113
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   114
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   115
A complication that is unique to non-blocking server mode is that it requires that the terminal be left in raw mode between calls to \fBgl_get_line()\fR. If this were not the case, the external event loop would not be able to detect individual key-presses, and the basic line editing implemented by the terminal driver would clash with the editing provided by \fBgl_get_line()\fR. When the terminal needs to be used for purposes other than entering a new input line with \fBgl_get_line()\fR, it needs to be restored to a usable state. In particular, whenever the process is suspended or terminated, the terminal must be returned to a normal state. If this is not done, then depending on the characteristics of the shell that was used to invoke the program, the user could end up with a hung terminal. To this end, the \fBgl_normal_io()\fR function is provided for switching the terminal back to the state that it was in when raw mode was last established.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   116
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   117
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   118
The \fBgl_normal_io()\fR function first flushes any pending output to the terminal, then moves the cursor to the start of the terminal line which follows the end of the incompletely entered input line. At this point it is safe to suspend or terminate the process, and it is safe for the application to read and write to the terminal. To resume entry of the input line, the application should call the \fBgl_raw_io()\fR function.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   119
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   120
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   121
The \fBgl_normal_io()\fR function starts a new line, redisplays the partially completed input line (if any), restores the cursor position within this line to where it was when \fBgl_normal_io()\fR was called, then switches back to raw, non-blocking terminal mode ready to continue entry of the input line when \fBgl_get_line()\fR is next called.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   122
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   123
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   124
Note that in non-blocking server mode, if \fBgl_get_line()\fR is called after a call to \fBgl_normal_io()\fR, without an intervening call to \fBgl_raw_io()\fR, \fBgl_get_line()\fR will call \fBgl_raw_mode()\fR itself, and the terminal will remain in this mode when \fBgl_get_line()\fR returns.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   125
.SS "Signal Handling"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   126
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   127
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   128
In the previous section it was pointed out that in non-blocking server mode, the terminal must be restored to a sane state whenever a signal is received that either suspends or terminates the process. In normal I/O mode, this is done for you by \fBgl_get_line()\fR, but in non-blocking server mode, since the terminal is left in raw mode between calls to \fBgl_get_line()\fR, this signal handling has to be done by the application. Since there are many signals that can suspend or terminate a process, as well as other signals that are important to \fBgl_get_line()\fR, such as the \fBSIGWINCH\fR signal, which tells it when the terminal size has changed, the \fBgl_tty_signals()\fR function is provided for installing signal handlers for all pertinent signals.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   129
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   130
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   131
The \fBgl_tty_signals()\fR function uses \fBgl_get_line()\fR's internal list of signals to assign specified signal handlers to groups of signals. The arguments of this function are as follows.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   132
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   133
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   134
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   135
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   136
\fB\fIterm_handler\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   137
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   138
.RS 16n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   139
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   140
This is the signal handler that is used to trap signals that by default terminate any process that receives them (for example, \fBSIGINT\fR or \fBSIGTERM\fR).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   141
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   142
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   143
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   144
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   145
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   146
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   147
\fB\fIsusp_handler\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   148
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   149
.RS 16n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   150
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   151
This is the signal handler that is used to trap signals that by default suspend any process that receives them, (for example, \fBSIGTSTP\fR or \fBSIGTTOU\fR).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   152
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   153
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   154
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   155
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   156
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   157
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   158
\fB\fIcont_handler\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   159
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   160
.RS 16n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   161
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   162
This is the signal handler that is used to trap signals that are usually sent when a process resumes after being suspended (usually \fBSIGCONT\fR). Beware that there is nothing to stop a user from sending one of these signals at other times.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   163
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   164
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   165
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   166
.ne 2
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   167
.mk
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   168
.na
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   169
\fB\fIsize_handler\fR\fR
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   170
.ad
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   171
.RS 16n
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   172
.rt  
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   173
This signal handler is used to trap signals that are sent to processes when their controlling terminals are resized by the user (for example, \fBSIGWINCH\fR).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   174
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   175
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   176
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   177
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   178
These arguments can all be the same, if so desired, and \fBSIG_IGN\fR (ignore this signal) or \fBSIG_DFL\fR (use the system-provided default signal handler) can be specified instead of a function where pertinent. In particular, it is rarely useful to trap \fBSIGCONT\fR, so the \fIcont_handler\fR argument will usually be \fBSIG_DFL\fR or \fBSIG_IGN\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   179
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   180
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   181
The \fBgl_tty_signals()\fR function uses the POSIX \fBsigaction\fR(2) function to install these signal handlers, and it is careful to use the \fIsa_mask\fR member of each \fBsigaction\fR structure to ensure that only one of these signals is ever delivered at a time. This guards against different instances of these signal handlers from simultaneously trying to write to common global data, such as a shared \fBsigsetjmp\fR(3C) buffer or a signal-received flag. The signal handlers installed by this function should call the \fBgl_handle_signal()\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   182
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   183
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   184
The \fIsigno\fR argument tells this function which signal it is being asked to respond to, and the \fIgl\fR argument should be a pointer to the first element of an array of \fIngl\fR \fBGetLine\fR objects. If your application has only one of these objects, pass its pointer as the \fIgl\fR argument and specify \fIngl\fR as 1.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   185
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   186
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   187
Depending on the signal that is being handled, this function does different things.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   188
.SS "Process termination signals"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   189
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   190
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   191
If the signal that was caught is one of those that by default terminates any process that receives it, then \fBgl_handle_signal()\fR does the following steps.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   192
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   193
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   194
1.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   195
First it blocks the delivery of all signals that can be blocked (ie. \fBSIGKILL\fR and \fBSIGSTOP\fR cannot be blocked).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   196
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   197
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   198
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   199
2.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   200
Next it calls \fBgl_normal_io()\fR for each of the ngl GetLine objects. Note that this does nothing to any of the GetLine objects that are not currently in raw mode.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   201
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   202
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   203
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   204
3.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   205
Next it sets the signal handler of the signal to its default, process-termination disposition.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   206
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   207
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   208
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   209
4.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   210
Next it re-sends the process the signal that was caught.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   211
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   212
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   213
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   214
5.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   215
Finally it unblocks delivery of this signal, which results in the process being terminated.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   216
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   217
.SS "Process suspension signals"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   218
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   219
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   220
If the default disposition of the signal is to suspend the process, the same steps are executed as for process termination signals, except that when the process is later resumed, \fBgl_handle_signal()\fR continues, and does the following steps.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   221
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   222
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   223
1.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   224
It re-blocks delivery of the signal.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   225
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   226
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   227
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   228
2.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   229
It reinstates the signal handler of the signal to the one that was displaced when its default disposition was substituted.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   230
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   231
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   232
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   233
3.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   234
For any of the GetLine objects that were in raw mode when \fBgl_handle_signal()\fR was called, \fBgl_handle_signal()\fR then calls \fBgl_raw_io()\fR, to resume entry of the input lines on those terminals.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   235
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   236
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   237
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   238
4.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   239
Finally, it restores the signal process mask to how it was when \fBgl_handle_signal()\fR was called.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   240
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   241
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   242
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   243
Note that the process is suspended or terminated using the original signal that was caught, rather than using the uncatchable \fBSIGSTOP\fR and \fBSIGKILL\fR signals. This is important, because when a process is suspended or terminated, the parent of the process may wish to use the status value returned by the wait system call to figure out which signal was responsible. In particular, most shells use this information to print a corresponding message to the terminal. Users would be rightly confused if when their process received a \fBSIGPIPE\fR signal, the program responded by sending itself a \fBSIGKILL\fR signal, and the shell then printed out the provocative statement, "Killed!".
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   244
.SS "Interrupting The Event Loop"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   245
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   246
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   247
If a signal is caught and handled when the application's event loop is waiting in \fBselect()\fR or \fBpoll()\fR, these functions will be aborted with \fBerrno\fR set to \fBEINTR\fR. When this happens the event loop should call \fBgl_pending_io()\fR before calling \fBselect()\fR or \fBpoll()\fR again. It should then arrange for \fBselect()\fR or \fBpoll()\fR to wait for the type of I/O that \fBgl_pending_io()\fR reports. This is necessary because any signal handler that calls \fBgl_handle_signal()\fR will frequently change the type of I/O that \fBgl_get_line()\fR is waiting for.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   248
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   249
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   250
If a signal arrives between the statements that configure the arguments of \fBselect()\fR or \fBpoll()\fR and the calls to these functions, the signal will not be seen by these functions, which will then not be aborted. If these functions are waiting for keyboard input from the user when the signal is received, and the signal handler arranges to redraw the input line to accommodate a terminal resize or the resumption of the process. This redisplay will be delayed until the user presses the next key. Apart from puzzling the user, this clearly is not a serious problem. However there is a way, albeit complicated, to completely avoid this race condition. The following steps illustrate this.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   251
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   252
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   253
1.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   254
Block all of the signals that \fBgl_get_line()\fR catches, by passing the signal set returned by \fBgl_list_signals()\fR to \fBsigprocmask\fR(2).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   255
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   256
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   257
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   258
2.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   259
Call \fBgl_pending_io()\fR and set up the arguments of \fBselect()\fR or \fBpoll()\fR accordingly.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   260
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   261
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   262
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   263
3.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   264
Call \fBsigsetjmp\fR(3C) with a non-zero \fIsavemask\fR argument.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   265
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   266
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   267
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   268
4.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   269
Initially this \fBsigsetjmp()\fR statement will return zero, indicating that control is not resuming there after a matching call to \fBsiglongjmp\fR(3C).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   270
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   271
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   272
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   273
5.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   274
Replace all of the handlers of the signals that \fBgl_get_line()\fR is configured to catch, with a signal handler that first records the number of the signal that was caught, in a file-scope variable, then calls \fBsiglongjmp()\fR with a non-zero \fIval\fR argument, to return execution to the above \fBsigsetjmp()\fR statement. Registering these signal handlers can conveniently be done using the \fBgl_tty_signals()\fR function.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   275
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   276
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   277
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   278
6.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   279
Set the file-scope variable that the above signal handler uses to record any signal that is caught to -1, so that we can check whether a signal was caught by seeing if it contains a valid signal number.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   280
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   281
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   282
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   283
7.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   284
Now unblock the signals that were blocked in step 1. Any signal that was received by the process in between step 1 and now will now be delivered, and trigger our signal handler, as will any signal that is received until we block these signals again.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   285
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   286
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   287
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   288
8.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   289
Now call \fBselect()\fR or \fBpoll()\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   290
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   291
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   292
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   293
9.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   294
When select returns, again block the signals that were unblocked in step 7.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   295
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   296
If a signal is arrived any time during the above steps, our signal handler will be triggered and cause control to return to the \fBsigsetjmp()\fR statement, where this time, \fBsigsetjmp()\fR will return non-zero, indicating that a signal was caught. When this happens we simply skip the above block of statements, and continue with the following statements, which are executed regardless of whether or not a signal is caught. Note that when \fBsigsetjmp()\fR returns, regardless of why it returned, the process signal mask is returned to how it was when \fBsigsetjmp()\fR was called. Thus the following statements are always executed with all of our signals blocked.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   297
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   298
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   299
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   300
10.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   301
Reinstate the signal handlers that were displaced in step 5.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   302
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   303
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   304
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   305
11.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   306
Check wether a signal was caught, by checking the file-scope variable that the signal handler records signal numbers in.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   307
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   308
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   309
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   310
12.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   311
If a signal was caught, send this signal to the application again and unblock only this signal so that it invokes the signal handler which was just reinstated in step 10.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   312
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   313
.RS +4
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   314
.TP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   315
13.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   316
Unblock all of the signals that were blocked in step 7.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   317
.RE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   318
.SS "Signals Caught By \fBgl_get_line()\fR"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   319
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   320
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   321
Since the application is expected to handle signals in non-blocking server mode, \fBgl_get_line()\fR does not attempt to duplicate this when it is being called. If one of the signals that it is configured to catch is sent to the application while \fBgl_get_line()\fR is being called, \fBgl_get_line()\fR reinstates the caller's signal handlers, then immediately before returning, re-sends the signal to the process to let the application's signal handler handle it. If the process is not terminated by this signal, \fBgl_get_line()\fR returns \fINULL\fR, and a following call to \fBgl_return_status()\fR returns the enumerated value \fBGLR_SIGNAL\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   322
.SS "Aborting Line Input"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   323
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   324
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   325
Often, rather than letting it terminate the process, applications respond to the \fBSIGINT\fR user-interrupt signal by aborting the current input line. This can be accomplished in non-blocking server-I/O mode by not calling \fBgl_handle_signal()\fR when this signal is caught, but by calling instead the \fBgl_abandon_line()\fR function. This function arranges that when \fBgl_get_line()\fR is next called, it first flushes any pending output to the terminal, discardes the current input line, outputs a new prompt on the next line, and finally starts accepting input of a new input line from the user.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   326
.SS "Signal Safe Functions"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   327
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   328
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   329
Provided that certain rules are followed, the \fBgl_normal_io()\fR, \fBgl_raw_io()\fR, \fBgl_handle_signal()\fR, and \fBgl_abandon_line()\fR functions can be written to be safely callable from signal handlers. Other functions in this library should not be called from signal handlers. For this to be true, all signal handlers that call these functions must be registered in such a way that only one instance of any one of them can be running at one time. The way to do this is to use the POSIX \fBsigaction()\fR function to register all signal handlers, and when doing this, use the \fIsa_mask\fR member of the corresponding \fBsigaction\fR structure to indicate that all of the signals whose handlers invoke the above functions should be blocked when the current signal is being handled. This prevents two signal handlers from operating on a \fBGetLine\fR object at the same time.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   330
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   331
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   332
To prevent signal handlers from accessing a \fBGetLine\fR object while \fBgl_get_line()\fR or any of its associated public functions are operating on it, all public functions associated with \fBgl_get_line()\fR, including \fBgl_get_line()\fR itself, temporarily block the delivery of signals when they are accessing \fBGetLine\fR objects. Beware that the only signals that they block are the signals that \fBgl_get_line()\fR is currently configured to catch, so be sure that if you call any of the above functions from signal handlers, that the signals that these handlers are assigned to are configured to be caught by \fBgl_get_line()\fR. See \fBgl_trap_signal\fR(3TECLA).
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   333
.SS "Using Timeouts To Poll"
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   334
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   335
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   336
If instead of using \fBselect()\fR or \fBpoll()\fR to wait for I/O your application needs only to get out of \fBgl_get_line()\fR periodically to briefly do something else before returning to accept input from the user, use the \fBgl_inactivity_timeout\fR(3TECLA) function in non-blocking server mode to specify that a callback function that returns \fBGLTO_CONTINUE\fR should be called whenever \fBgl_get_line()\fR has been waiting for I/O for more than a specified amount of time. When this callback is triggered, \fBgl_get_line()\fR will return \fINULL\fR and a following call to \fBgl_return_status()\fR will return \fBGLR_BLOCKED\fR.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   337
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   338
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   339
The \fBgl_get_line()\fR function will not return until the user has not typed a key for the specified interval, so if the interval is long and the user keeps typing, \fBgl_get_line()\fR might not return for a while. There is no guarantee that it will return in the time specified.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   340
.SH ATTRIBUTES
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   341
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   342
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   343
See \fBattributes\fR(5) for descriptions of the following attributes:
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   344
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   345
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   346
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   347
.TS
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   348
tab() box;
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   349
cw(2.75i) |cw(2.75i) 
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   350
lw(2.75i) |lw(2.75i) 
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   351
.
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   352
ATTRIBUTE TYPEATTRIBUTE VALUE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   353
_
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   354
Interface StabilityCommitted
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   355
_
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   356
MT-LevelMT-Safe
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   357
.TE
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   358
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   359
.SH SEE ALSO
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   360
.sp
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   361
.LP
7c568e880861 7143177 move libtecla from ON to Userland (Userland portion)
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   362
\fBcpl_complete_word\fR(3TECLA), \fBef_expand_file\fR(3TECLA), \fBgl_get_line\fR(3TECLA), \fBlibtecla\fR(3LIB), \fBpca_lookup_file\fR(3TECLA), \fBattributes\fR(5), \fBtecla\fR(5)