term.c revision 6a4ac6ccc8f8733b0dfce917af3844bfbc51900c
176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/*
276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * All rights reserved.
476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Redistribution and use in source and binary forms, with or without
676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * modification, are permitted provided that the following conditions
776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * are met:
876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1. Redistributions of source code must retain the above copyright
976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer.
1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 2. Redistributions in binary form must reproduce the above copyright
1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer in the
1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    documentation and/or other materials provided with the distribution.
1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3. The name of the author may not be used to endorse or promote products
1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    derived from this software without specific prior written permission.
1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *	$Id$
2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */
2976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h"
3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
326e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#ifdef LINUX
336e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath/*
346e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath * The C library's definition of struct termios might differ from
356e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath * the kernel one, and we need to use the kernel layout.
366e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath */
376e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#include <linux/termios.h>
386e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#else
396e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath
402e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#ifdef HAVE_TERMIO_H
4176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <termio.h>
422e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#endif /* HAVE_TERMIO_H */
432e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman
4476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <termios.h>
456e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#endif
462e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman
4776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_SYS_FILIO_H
4876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/filio.h>
4976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
5076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
51d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat tcxonc_options[] = {
5276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCOOFF,	"TCOOFF"	},
5376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCOON,	"TCOON"		},
5476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCIOFF,	"TCIOFF"	},
5576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCION,	"TCION"		},
5676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
5776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
5876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
59bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCLFLSH
60d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat tcflsh_options[] = {
6176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCIFLUSH,	"TCIFLUSH"	},
6276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCOFLUSH,	"TCOFLUSH"	},
6376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TCIOFLUSH,	"TCIOFLUSH"	},
6476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
6576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
66bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif
6776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
68d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat baud_options[] = {
6976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B0,		"B0"		},
7076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B50,		"B50"		},
7176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B75,		"B75"		},
7276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B110,		"B110"		},
7376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B134,		"B134"		},
7476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B150,		"B150"		},
7576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B200,		"B200"		},
7676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B300,		"B300"		},
7776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B600,		"B600"		},
7876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B1200,	"B1200"		},
7976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B1800,	"B1800"		},
8076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B2400,	"B2400"		},
8176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B4800,	"B4800"		},
8276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B9600,	"B9600"		},
8376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef B19200
8476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B19200,	"B19200"	},
8576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
8676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef B38400
8776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ B38400,	"B38400"	},
8876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
895ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B57600
905ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B57600,	"B57600"	},
915ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
925ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B115200
935ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B115200,	"B115200"	},
945ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
955ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B230400
965ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B230400,	"B230400"	},
975ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
985ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B460800
995ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B460800,	"B460800"	},
1005ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1015ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B500000
1025ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B500000,	"B500000"	},
1035ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1045ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B576000
1055ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B576000,	"B576000"	},
1065ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1075ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B921600
1085ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B921600,	"B921600"	},
1095ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1105ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B1000000
1115ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B1000000,	"B1000000"	},
1125ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1135ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B1152000
1145ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B1152000,	"B1152000"	},
1155ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1165ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B1500000
1175ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B1500000,	"B1500000"	},
1185ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1195ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B2000000
1205ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B2000000,	"B2000000"	},
1215ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1225ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B2500000
1235ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B2500000,	"B2500000"	},
1245ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1255ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B3000000
1265ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B3000000,	"B3000000"	},
1275ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1285ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B3500000
1295ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B3500000,	"B3500000"	},
1305ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
1315ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#ifdef B4000000
1325ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman	{ B4000000,	"B4000000"	},
1335ae21ead9f83597452f9a0517e8a51fa4823f921Wichert Akkerman#endif
13476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef EXTA
13576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ EXTA,		"EXTA"		},
13676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
13776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef EXTB
13876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ EXTB,		"EXTB"		},
13976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
14076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
14176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
14276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
143d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat modem_flags[] = {
14476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_LE
14576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_LE,	"TIOCM_LE",	},
14676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
14776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_DTR
14876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_DTR,	"TIOCM_DTR",	},
14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_RTS
15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_RTS,	"TIOCM_RTS",	},
15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_ST
15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_ST,	"TIOCM_ST",	},
15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_SR
15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_SR,	"TIOCM_SR",	},
15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_CTS
16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_CTS,	"TIOCM_CTS",	},
16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_CAR
16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_CAR,	"TIOCM_CAR",	},
16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_CD
16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_CD,	"TIOCM_CD",	},
16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_RNG
16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_RNG,	"TIOCM_RNG",	},
17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
17176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_RI
17276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_RI,	"TIOCM_RI",	},
17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
17476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCM_DSR
17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ TIOCM_DSR,	"TIOCM_DSR",	},
17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
17776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL,		},
17876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
17976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
18076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
181e5e60858063f214fcd7860f50f8bcb46f951f9abDmitry V. Levinint term_ioctl(struct tcb *tcp, long code, long arg)
18276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
18376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct termios tios;
184bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifndef FREEBSD
18576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct termio tio;
186bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#else
1872e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman	#define TCGETS	TIOCGETA
1882e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman	#define TCSETS	TIOCSETA
1892e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman	#define TCSETSW	TIOCSETAW
1902e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman	#define TCSETSF	TIOCSETAF
1916e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#endif
19276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct winsize ws;
19376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSIZE
19476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct  ttysize ts;
19576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
19676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i;
19776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
19876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp))
19976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 0;
20076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
20176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	switch (code) {
20276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
20376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with termios or termio args */
20476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
20576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TCGETS
20676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCGETS:
20776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
20876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
20976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETS:
21076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETSW:
21176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETSF:
21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!verbose(tcp) || umove(tcp, arg, &tios) < 0)
21376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (abbrev(tcp)) {
21560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko			tprints(", {");
2166e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#ifndef FREEBSD
21776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printxval(baud_options, tios.c_cflag & CBAUD, "B???");
2182e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman#else
2192e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman			printxval(baud_options, tios.c_ispeed, "B???");
2202e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman			if (tios.c_ispeed != tios.c_ospeed) {
22160fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(" (in)");
2222e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman				printxval(baud_options, tios.c_ospeed, "B???");
22360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(" (out)");
2242e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman			}
2256e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#endif
22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(" %sopost %sisig %sicanon %secho ...}",
22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tios.c_oflag & OPOST) ? "" : "-",
22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tios.c_lflag & ISIG) ? "" : "-",
22976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tios.c_lflag & ICANON) ? "" : "-",
23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tios.c_lflag & ECHO) ? "" : "-");
23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {c_iflags=%#lx, c_oflags=%#lx, ",
23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			(long) tios.c_iflag, (long) tios.c_oflag);
23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			(long) tios.c_cflag, (long) tios.c_lflag);
2372e4ffe59b588159eb80e236f068278ba47735932Wichert Akkerman#if !defined(SVR4) && !defined(FREEBSD)
23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_line=%u, ", tios.c_line);
23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!(tios.c_lflag & ICANON))
24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tios.c_cc[VMIN], tios.c_cc[VTIME]);
24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_cc=\"");
24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 0; i < NCCS; i++)
24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("\\x%02x", tios.c_cc[i]);
24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("\"}");
24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TCGETS */
24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TCGETA
25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCGETA:
25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETA:
25576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETAW:
25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCSETAF:
25776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!verbose(tcp) || umove(tcp, arg, &tio) < 0)
25876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
25976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (abbrev(tcp)) {
26060fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko			tprints(", {");
26176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printxval(baud_options, tio.c_cflag & CBAUD, "B???");
26276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(" %sopost %sisig %sicanon %secho ...}",
26376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tio.c_oflag & OPOST) ? "" : "-",
26476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tio.c_lflag & ISIG) ? "" : "-",
26576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tio.c_lflag & ICANON) ? "" : "-",
26676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				(tio.c_lflag & ECHO) ? "" : "-");
26776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
26876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
26976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {c_iflags=%#lx, c_oflags=%#lx, ",
27076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			(long) tio.c_iflag, (long) tio.c_oflag);
27176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
27276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			(long) tio.c_cflag, (long) tio.c_lflag);
27376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_line=%u, ", tio.c_line);
27476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef _VMIN
27576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!(tio.c_lflag & ICANON))
27676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("c_cc[_VMIN]=%d, c_cc[_VTIME]=%d, ",
27776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tio.c_cc[_VMIN], tio.c_cc[_VTIME]);
27876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#else /* !_VMIN */
27976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!(tio.c_lflag & ICANON))
28076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
28176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tio.c_cc[VMIN], tio.c_cc[VTIME]);
28276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !_VMIN */
28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("c_cc=\"");
28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 0; i < NCC; i++)
28576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("\\x%02x", tio.c_cc[i]);
28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("\"}");
28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
28876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TCGETA */
28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with winsize or ttysize args */
29176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
29276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGWINSZ
29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGWINSZ:
29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSWINSZ:
29776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!verbose(tcp) || umove(tcp, arg, &ws) < 0)
29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {ws_row=%d, ws_col=%d, ws_xpixel=%d, ws_ypixel=%d}",
30076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			ws.ws_row, ws.ws_col, ws.ws_xpixel, ws.ws_ypixel);
30176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
30276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TIOCGWINSZ */
30376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
30476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSIZE
30576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGSIZE:
30676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
30776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
30876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSSIZE:
30976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!verbose(tcp) || umove(tcp, arg, &ts) < 0)
31076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
31176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {ts_lines=%d, ts_cols=%d}",
31276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			ts.ts_lines, ts.ts_cols);
31376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
31476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
31576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with a direct decodable arg */
317bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCXONC
31876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCXONC:
31960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
32076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(tcxonc_options, arg, "TC???");
32176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
322bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif
323bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCLFLSH
32476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TCFLSH:
32560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
32676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(tcflsh_options, arg, "TC???");
32776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
328bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif
3296a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko#ifdef TIOCSCTTY
3306a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko	case TIOCSCTTY:
3316a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko		tprintf(", %ld", arg);
3326a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko		return 1;
3336a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko#endif
33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with an indirect parameter displayed as modem flags */
33676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
33776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCMGET
33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCMGET:
33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCMBIS:
34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCMBIC:
34176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCMSET:
342bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath		if (umove(tcp, arg, &i) < 0)
34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
34460fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", [");
345bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath		printflags(modem_flags, i, "TIOCM_???");
34660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("]");
34776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
34876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TIOCMGET */
34976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
35076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with an indirect parameter displayed in decimal */
35176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
35276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSPGRP:
35376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGPGRP:
35476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGETPGRP
35576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGETPGRP:
35676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
35776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSETPGRP
35876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSETPGRP:
35976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
36076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONREAD
36176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIONREAD:
36276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
36376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCOUTQ:
36476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONBIO
36576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIONBIO:
36676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
36776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOASYNC
36876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIOASYNC:
36976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
37076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOGETOWN
37176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIOGETOWN:
37276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
37376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOSETOWN
37476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIOSETOWN:
37576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
37676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGETD
37776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGETD:
37876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
37976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSETD
38076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSETD:
38176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
38276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCPKT
38376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCPKT:
38476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
38576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCREMOTE
38676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCREMOTE:
38776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
38876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCUCNTL
38976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCUCNTL:
39076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCTCNTL
39276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCTCNTL:
39376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSIGNAL
39576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSIGNAL:
39676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSSOFTCAR
39876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSSOFTCAR:
39976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSOFTCAR
40176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCGSOFTCAR:
40276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCISPACE
40476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCISPACE:
40576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCISIZE
40776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCISIZE:
40876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSINTR
41076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSINTR:
41176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
4122e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#ifdef TIOCSPTLCK
4132e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman	case TIOCSPTLCK:
4142e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#endif
4152e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#ifdef TIOCGPTN
4162e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman	case TIOCGPTN:
4172e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#endif
41860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
419bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath		printnum_int(tcp, arg, "%d");
42076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
42176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
42276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with an indirect parameter displayed as a char */
42376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
42476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSTI
42576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCSTI:
42676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
42760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
42876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstr(tcp, arg, 1);
42976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
43076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
43176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls with no parameters */
43276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
43376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCNOTTY
43476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCNOTTY:
43576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
43676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOCLEX
43776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIOCLEX:
43876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
43976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONCLEX
44076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case FIONCLEX:
44176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
44276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCCONS
44376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TIOCCONS:
44476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
44576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
44676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
44776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* ioctls which are unknown */
44876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
44976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	default:
45076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 0;
45176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
45276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
453