/* $NetBSD: ttcompat.c,v 1.12 2003/08/07 11:25:28 agc Exp $ */
/*
* Copyright (c) 1995
* The Regents of the University of California. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* ttcompat.c -- convert sgtty flags to termios
* originally from /sys/kern/tty_compat.c
*/
/* Nothing we can do with CRTBS. */
if (ISSET(flags, PRTERA))
CLR(lflag, ECHOPRT);
if (ISSET(flags, CRTERA))
CLR(lflag, ECHOE);
/* Nothing we can do with TILDE. */
if (ISSET(flags, MDMBUF))
CLR(cflag, MDMBUF);
if (ISSET(flags, NOHANG))
SET(cflag, HUPCL);
if (ISSET(flags, CRTKIL))
CLR(lflag, ECHOKE);
if (ISSET(flags, CTLECH))
CLR(lflag, ECHOCTL);
if (ISSET(flags, DECCTQ))
SET(iflag, IXANY);
CLR(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));
/* Nothing we can do with CRTBS. */
if (ISSET(flags, PRTERA))
SET(lflag, ECHOPRT);
if (ISSET(flags, CRTERA))
SET(lflag, ECHOE);
/* Nothing we can do with TILDE. */
if (ISSET(flags, MDMBUF))
SET(cflag, MDMBUF);
if (ISSET(flags, NOHANG))
CLR(cflag, HUPCL);
if (ISSET(flags, CRTKIL))
SET(lflag, ECHOKE);
if (ISSET(flags, CTLECH))
SET(lflag, ECHOCTL);
if (ISSET(flags, DECCTQ))
CLR(iflag, IXANY);
SET(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));