maint: update copyright
[gnulib.git] / lib / pty.in.h
1 /* Substitute for and wrapper around <pty.h>.
2    Copyright (C) 2010-2014 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, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef _@GUARD_PREFIX@_PTY_H
18
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
23
24 /* The include_next requires a split double-inclusion guard.  */
25 #if @HAVE_PTY_H@
26 # @INCLUDE_NEXT@ @NEXT_PTY_H@
27 #endif
28
29 #ifndef _@GUARD_PREFIX@_PTY_H
30 #define _@GUARD_PREFIX@_PTY_H
31
32 /* Some platforms declare this in a different header than glibc.  */
33 #if @HAVE_UTIL_H@
34 # include <util.h>
35 #endif
36 #if @HAVE_LIBUTIL_H@
37 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0.  */
38 # include <sys/types.h>
39 # include <libutil.h>
40 #endif
41
42 /* Get 'struct termios' and 'struct winsize'.  */
43 #include <termios.h>
44 #if defined _AIX
45 # include <sys/ioctl.h>
46 #endif
47 /* Mingw lacks 'struct termios' and 'struct winsize', but a forward
48    declaration of an opaque type is sufficient to allow compilation of
49    a stub openpty().  */
50 struct termios;
51 struct winsize;
52
53 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
54
55 /* The definition of _GL_WARN_ON_USE is copied here.  */
56
57
58 /* Declare overridden functions.  */
59
60 #if @GNULIB_FORKPTY@
61 /* Create pseudo tty master slave pair and set terminal attributes
62    according to TERMP and WINP.  Fork a child process attached to the
63    slave end.  Return a handle for the master end in *AMASTER, and
64    return the name of the slave end in NAME.  */
65 # if @REPLACE_FORKPTY@
66 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
67 #   undef forkpty
68 #   define forkpty rpl_forkpty
69 #  endif
70 _GL_FUNCDECL_RPL (forkpty, int,
71                   (int *amaster, char *name,
72                    struct termios const *termp, struct winsize const *winp));
73 _GL_CXXALIAS_RPL (forkpty, int,
74                   (int *amaster, char *name,
75                    struct termios const *termp, struct winsize const *winp));
76 # else
77 #  if !@HAVE_FORKPTY@
78 _GL_FUNCDECL_SYS (forkpty, int,
79                   (int *amaster, char *name,
80                    struct termios const *termp, struct winsize const *winp));
81 #  endif
82 _GL_CXXALIAS_SYS (forkpty, int,
83                   (int *amaster, char *name,
84                    struct termios const *termp, struct winsize const *winp));
85 # endif
86 _GL_CXXALIASWARN (forkpty);
87 #elif defined GNULIB_POSIXCHECK
88 # undef forkpty
89 # if HAVE_RAW_DECL_FORKPTY
90 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
91                  "use gnulib module forkpty for portability");
92 # endif
93 #endif
94
95 #if @GNULIB_OPENPTY@
96 /* Create pseudo tty master slave pair and set terminal attributes
97    according to TERMP and WINP.  Return handles for both ends in
98    *AMASTER and *ASLAVE, and return the name of the slave end in NAME.  */
99 # if @REPLACE_OPENPTY@
100 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
101 #   undef openpty
102 #   define openpty rpl_openpty
103 #  endif
104 _GL_FUNCDECL_RPL (openpty, int,
105                   (int *amaster, int *aslave, char *name,
106                    struct termios const *termp, struct winsize const *winp));
107 _GL_CXXALIAS_RPL (openpty, int,
108                   (int *amaster, int *aslave, char *name,
109                    struct termios const *termp, struct winsize const *winp));
110 # else
111 #  if !@HAVE_OPENPTY@
112 _GL_FUNCDECL_SYS (openpty, int,
113                   (int *amaster, int *aslave, char *name,
114                    struct termios const *termp, struct winsize const *winp));
115 #  endif
116 _GL_CXXALIAS_SYS (openpty, int,
117                   (int *amaster, int *aslave, char *name,
118                    struct termios const *termp, struct winsize const *winp));
119 # endif
120 _GL_CXXALIASWARN (openpty);
121 #elif defined GNULIB_POSIXCHECK
122 # undef openpty
123 # if HAVE_RAW_DECL_OPENPTY
124 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
125                  "use gnulib module openpty for portability");
126 # endif
127 #endif
128
129
130 #endif /* _@GUARD_PREFIX@_PTY_H */
131 #endif /* _@GUARD_PREFIX@_PTY_H */