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