xref: /netbsd-src/lib/libc/termios/tcsetwinsize.c (revision 673e27def2c54f62a376d84af78191b65efe6d90)
1*673e27deSkre /*	$NetBSD: tcsetwinsize.c,v 1.1 2017/10/25 06:32:59 kre Exp $	*/
2*673e27deSkre 
3*673e27deSkre /*-
4*673e27deSkre  * Copyright (c) 2017 The NetBSD Foundation, Inc.
5*673e27deSkre  * All rights reserved.
6*673e27deSkre  *
7*673e27deSkre  * This code is derived from software contributed to The NetBSD Foundation
8*673e27deSkre  * by
9*673e27deSkre  *
10*673e27deSkre  * Redistribution and use in source and binary forms, with or without
11*673e27deSkre  * modification, are permitted provided that the following conditions
12*673e27deSkre  * are met:
13*673e27deSkre  * 1. Redistributions of source code must retain the above copyright
14*673e27deSkre  *    notice, this list of conditions and the following disclaimer.
15*673e27deSkre  * 2. Redistributions in binary form must reproduce the above copyright
16*673e27deSkre  *    notice, this list of conditions and the following disclaimer in the
17*673e27deSkre  *    documentation and/or other materials provided with the distribution.
18*673e27deSkre  *
19*673e27deSkre  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*673e27deSkre  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*673e27deSkre  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*673e27deSkre  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*673e27deSkre  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*673e27deSkre  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*673e27deSkre  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*673e27deSkre  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*673e27deSkre  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*673e27deSkre  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*673e27deSkre  * POSSIBILITY OF SUCH DAMAGE.
30*673e27deSkre  */
31*673e27deSkre 
32*673e27deSkre #include <sys/cdefs.h>
33*673e27deSkre #if defined(LIBC_SCCS) && !defined(lint)
34*673e27deSkre __RCSID("$NetBSD: tcsetwinsize.c,v 1.1 2017/10/25 06:32:59 kre Exp $");
35*673e27deSkre #endif /* LIBC_SCCS and not lint */
36*673e27deSkre 
37*673e27deSkre #ifndef _NETBSD_SOURCE
38*673e27deSkre #define _NETBSD_SOURCE		/* need the ioctl values to be in <termios.h> */
39*673e27deSkre #endif
40*673e27deSkre 
41*673e27deSkre #include <sys/ioctl.h>
42*673e27deSkre #include <termios.h>
43*673e27deSkre 
44*673e27deSkre int
tcsetwinsize(int fd,const struct winsize * ws)45*673e27deSkre tcsetwinsize(int fd, const struct winsize *ws)
46*673e27deSkre {
47*673e27deSkre 	return ioctl(fd, TIOCSWINSZ, ws);
48*673e27deSkre }
49