gtty.c revision 1.8
11.8Ssalo/* $NetBSD: gtty.c,v 1.8 2003/07/26 19:24:55 salo Exp $ */
21.5Scgd
31.1Scgd/*
41.1Scgd * Copyright (c) 1994 Christopher G. Demetriou
51.1Scgd * All rights reserved.
61.6Scgd *
71.1Scgd * Redistribution and use in source and binary forms, with or without
81.1Scgd * modification, are permitted provided that the following conditions
91.1Scgd * are met:
101.1Scgd * 1. Redistributions of source code must retain the above copyright
111.1Scgd *    notice, this list of conditions and the following disclaimer.
121.1Scgd * 2. Redistributions in binary form must reproduce the above copyright
131.1Scgd *    notice, this list of conditions and the following disclaimer in the
141.1Scgd *    documentation and/or other materials provided with the distribution.
151.1Scgd * 3. All advertising materials mentioning features or use of this software
161.1Scgd *    must display the following acknowledgement:
171.6Scgd *          This product includes software developed for the
181.8Ssalo *          NetBSD Project.  See http://www.NetBSD.org/ for
191.6Scgd *          information about NetBSD.
201.1Scgd * 4. The name of the author may not be used to endorse or promote products
211.6Scgd *    derived from this software without specific prior written permission.
221.6Scgd *
231.1Scgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Scgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Scgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Scgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Scgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Scgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
291.1Scgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Scgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Scgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Scgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.6Scgd *
341.6Scgd * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
351.1Scgd */
361.1Scgd
371.2Slukem#include <sys/cdefs.h>
381.7Smsaitoh#if defined(LIBC_SCCS) && !defined(lint)
391.8Ssalo__RCSID("$NetBSD: gtty.c,v 1.8 2003/07/26 19:24:55 salo Exp $");
401.7Smsaitoh#endif /* LIBC_SCCS and not lint */
411.1Scgd
421.3Slukem#include <assert.h>
431.3Slukem#include <errno.h>
441.1Scgd#include <sgtty.h>
451.1Scgd
461.1Scgd/*
471.1Scgd * Get tty modes.
481.1Scgd * This was defined in ioctl_compat.h as:
491.1Scgd *	#define	gtty(fd, tty)	ioctl(fd, TIOCGETP, tty)
501.1Scgd */
511.1Scgdint
521.1Scgdgtty(fd, tty)
531.1Scgd	int fd;
541.1Scgd	struct sgttyb *tty;
551.1Scgd{
561.3Slukem
571.3Slukem	_DIAGASSERT(fd != -1);
581.3Slukem	_DIAGASSERT(tty != 0);
591.1Scgd
601.1Scgd	return (ioctl(fd, TIOCGETP, tty));
611.1Scgd}
62