alignof: Avoid collision with stdalign module.
[gnulib.git] / lib / pty.in.h
1 /* Substitute for and wrapper around <pty.h>.
2    Copyright (C) 2010-2011 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 #ifndef _@GUARD_PREFIX@_PTY_H
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 /* The include_next requires a split double-inclusion guard.  */
26 #if @HAVE_PTY_H@
27 # @INCLUDE_NEXT@ @NEXT_PTY_H@
28 #endif
29
30 #ifndef _@GUARD_PREFIX@_PTY_H
31 #define _@GUARD_PREFIX@_PTY_H
32
33 /* Some platforms declare this in a different header than glibc.  */
34 #if @HAVE_UTIL_H@
35 # include <util.h>
36 #endif
37 #if @HAVE_LIBUTIL_H@
38 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
39 # include <sys/types.h>
40 # include <libutil.h>
41 #endif
42
43 /* Get 'struct termios' and 'struct winsize'.  */
44 #include <termios.h>
45 #if defined _AIX
46 # include <sys/ioctl.h>
47 #endif
48
49 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
50
51 /* The definition of _GL_WARN_ON_USE is copied here.  */
52
53
54 /* Declare overridden functions.  */
55
56 #if @GNULIB_FORKPTY@
57 /* Create pseudo tty master slave pair and set terminal attributes
58    according to TERMP and WINP.  Fork a child process attached to the
59    slave end.  Return a handle for the master end in *AMASTER, and
60    return the name of the slave end in NAME.  */
61 # if @REPLACE_FORKPTY@
62 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
63 #   undef forkpty
64 #   define forkpty rpl_forkpty
65 #  endif
66 _GL_FUNCDECL_RPL (forkpty, int,
67                   (int *amaster, char *name,
68                    struct termios const *termp, struct winsize const *winp));
69 _GL_CXXALIAS_RPL (forkpty, int,
70                   (int *amaster, char *name,
71                    struct termios const *termp, struct winsize const *winp));
72 # else
73 #  if !@HAVE_FORKPTY@
74 _GL_FUNCDECL_SYS (forkpty, int,
75                   (int *amaster, char *name,
76                    struct termios const *termp, struct winsize const *winp));
77 #  endif
78 _GL_CXXALIAS_SYS (forkpty, int,
79                   (int *amaster, char *name,
80                    struct termios const *termp, struct winsize const *winp));
81 # endif
82 _GL_CXXALIASWARN (forkpty);
83 #elif defined GNULIB_POSIXCHECK
84 # undef forkpty
85 # if HAVE_RAW_DECL_FORKPTY
86 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
87                  "use gnulib module forkpty for portability");
88 # endif
89 #endif
90
91 #if @GNULIB_OPENPTY@
92 /* Create pseudo tty master slave pair and set terminal attributes
93    according to TERMP and WINP.  Return handles for both ends in
94    *AMASTER and *ASLAVE, and return the name of the slave end in NAME.  */
95 # if @REPLACE_OPENPTY@
96 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
97 #   undef openpty
98 #   define openpty rpl_openpty
99 #  endif
100 _GL_FUNCDECL_RPL (openpty, int,
101                   (int *amaster, int *aslave, char *name,
102                    struct termios const *termp, struct winsize const *winp));
103 _GL_CXXALIAS_RPL (openpty, int,
104                   (int *amaster, int *aslave, char *name,
105                    struct termios const *termp, struct winsize const *winp));
106 # else
107 #  if !@HAVE_OPENPTY@
108 _GL_FUNCDECL_SYS (openpty, int,
109                   (int *amaster, int *aslave, char *name,
110                    struct termios const *termp, struct winsize const *winp));
111 #  endif
112 _GL_CXXALIAS_SYS (openpty, int,
113                   (int *amaster, int *aslave, char *name,
114                    struct termios const *termp, struct winsize const *winp));
115 # endif
116 _GL_CXXALIASWARN (openpty);
117 #elif defined GNULIB_POSIXCHECK
118 # undef openpty
119 # if HAVE_RAW_DECL_OPENPTY
120 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
121                  "use gnulib module openpty for portability");
122 # endif
123 #endif
124
125
126 #endif /* _@GUARD_PREFIX@_PTY_H */
127 #endif /* _@GUARD_PREFIX@_PTY_H */