1/*	$NetBSD$	*/
2
3/* Generic termios.h */
4/* OpenLDAP: pkg/ldap/include/ac/termios.h,v 1.18.2.5 2010/04/13 20:22:52 kurt Exp */
5/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6 *
7 * Copyright 1998-2010 The OpenLDAP Foundation.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted only as authorized by the OpenLDAP
12 * Public License.
13 *
14 * A copy of this license is available in file LICENSE in the
15 * top-level directory of the distribution or, alternatively, at
16 * <http://www.OpenLDAP.org/license.html>.
17 */
18
19#ifndef _AC_TERMIOS_H
20#define _AC_TERMIOS_H
21
22#ifdef HAVE_TERMIOS_H
23#include <termios.h>
24
25#ifdef GCWINSZ_IN_SYS_IOCTL
26#include <sys/ioctl.h>
27#endif
28
29#define TERMIO_TYPE	struct termios
30#define TERMFLAG_TYPE	tcflag_t
31#define GETATTR( fd, tiop )	tcgetattr((fd), (tiop))
32#define SETATTR( fd, tiop )	tcsetattr((fd), TCSANOW /* 0 */, (tiop))
33#define GETFLAGS( tio )		((tio).c_lflag)
34#define SETFLAGS( tio, flags )	((tio).c_lflag = (flags))
35
36#elif defined( HAVE_SGTTY_H )
37#include <sgtty.h>
38
39#ifdef HAVE_SYS_IOCTL_H
40#include <sys/ioctl.h>
41#endif
42
43#define TERMIO_TYPE	struct sgttyb
44#define TERMFLAG_TYPE	int
45#define GETATTR( fd, tiop )	ioctl((fd), TIOCGETP, (caddr_t)(tiop))
46#define SETATTR( fd, tiop )	ioctl((fd), TIOCSETP, (caddr_t)(tiop))
47#define GETFLAGS( tio )     ((tio).sg_flags)
48#define SETFLAGS( tio, flags )  ((tio).sg_flags = (flags))
49
50#endif /* HAVE_SGTTY_H */
51
52#endif /* _AC_TERMIOS_H */
53