4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
44 #include <sys/types.h>
45 #include "curses_inc.h"
49 * Set the current time-out period for getting input.
51 * delay: < 0 for infinite delay (blocking read)
52 * = 0 for no delay read
53 * > 0 to specify a period in millisecs to wait
54 * for input, then return '\0' if none comes
57 static void _setblock(int), _settimeout(int);
62 if (cur_term
->_inputfd
< 0)
68 if (cur_term
->_delay
== delay
)
73 if (cur_term
->_delay
< 0)
77 if ((delay
+ cur_term
->_delay
) == -1)
88 cur_term
->_delay
= delay
;
94 /* set the terminal to nodelay (==0) or block(<0) */
98 int flags
= fcntl(cur_term
->_inputfd
, F_GETFL
, 0);
105 (void) fcntl(cur_term
->_inputfd
, F_SETFL
, flags
);
109 * set the terminal to timeout in t milliseconds,
110 * rounded up to the nearest 10th of a second.
115 PROGTTYS
.c_lflag
&= ~ICANON
;
117 PROGTTYS
.c_cc
[VMIN
] = 0;
118 PROGTTYS
.c_cc
[VTIME
] = (num
> 25500) ? 255 : (num
+ 99) / 100;
119 cur_term
->_fl_rawmode
= 3;
121 PROGTTYS
.c_cc
[VMIN
] = 1;
122 PROGTTYS
.c_cc
[VTIME
] = 0;
123 cur_term
->_fl_rawmode
= 1;
125 (void) reset_prog_mode();