xref: /minix3/lib/libcurses/nodelay.c (revision 51ffecc181005cb45a40108612ee28d1daaeeb86)
1*51ffecc1SBen Gras /*      $NetBSD: nodelay.c,v 1.6 2003/12/04 21:24:36 jdc Exp $  */
2*51ffecc1SBen Gras 
3*51ffecc1SBen Gras /*-
4*51ffecc1SBen Gras  * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com)
5*51ffecc1SBen Gras  * All rights reserved.
6*51ffecc1SBen Gras  *
7*51ffecc1SBen Gras  * Redistribution and use in source and binary forms, with or without
8*51ffecc1SBen Gras  * modification, are permitted provided that the following conditions
9*51ffecc1SBen Gras  * are met:
10*51ffecc1SBen Gras  * 1. Redistributions of source code must retain the above copyright
11*51ffecc1SBen Gras  *    notice, this list of conditions and the following disclaimer.
12*51ffecc1SBen Gras  * 2. The name of the author may not be used to endorse or promote products
13*51ffecc1SBen Gras  *    derived from this software without specific prior written permission
14*51ffecc1SBen Gras  *
15*51ffecc1SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*51ffecc1SBen Gras  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*51ffecc1SBen Gras  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*51ffecc1SBen Gras  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*51ffecc1SBen Gras  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*51ffecc1SBen Gras  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*51ffecc1SBen Gras  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*51ffecc1SBen Gras  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*51ffecc1SBen Gras  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*51ffecc1SBen Gras  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*51ffecc1SBen Gras  *
26*51ffecc1SBen Gras  *
27*51ffecc1SBen Gras  */
28*51ffecc1SBen Gras 
29*51ffecc1SBen Gras #include <sys/cdefs.h>
30*51ffecc1SBen Gras #ifndef lint
31*51ffecc1SBen Gras __RCSID("$NetBSD: nodelay.c,v 1.6 2003/12/04 21:24:36 jdc Exp $");
32*51ffecc1SBen Gras #endif				/* not lint */
33*51ffecc1SBen Gras 
34*51ffecc1SBen Gras #include "curses.h"
35*51ffecc1SBen Gras #include "curses_private.h"
36*51ffecc1SBen Gras 
37*51ffecc1SBen Gras /*
38*51ffecc1SBen Gras  * nodelay --
39*51ffecc1SBen Gras  *	Turn on and off blocking reads in getch for a
40*51ffecc1SBen Gras  *	given window.
41*51ffecc1SBen Gras  */
42*51ffecc1SBen Gras int
nodelay(WINDOW * win,bool bf)43*51ffecc1SBen Gras nodelay(WINDOW *win, bool bf)
44*51ffecc1SBen Gras {
45*51ffecc1SBen Gras 	if (bf)
46*51ffecc1SBen Gras 		win->delay = 0;
47*51ffecc1SBen Gras 	else
48*51ffecc1SBen Gras 		win->delay = -1;
49*51ffecc1SBen Gras 	return(OK);
50*51ffecc1SBen Gras }
51