1 /* Substitute for and wrapper around <pty.h>.
2 Copyright (C) 2010-2011 Free Software Foundation, Inc.
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)
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.
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. */
18 #ifndef _@GUARD_PREFIX@_PTY_H
21 @PRAGMA_SYSTEM_HEADER@
25 /* The include_next requires a split double-inclusion guard. */
27 # @INCLUDE_NEXT@ @NEXT_PTY_H@
30 #ifndef _@GUARD_PREFIX@_PTY_H
31 #define _@GUARD_PREFIX@_PTY_H
33 /* Some platforms declare this in a different header than glibc. */
38 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
39 # include <sys/types.h>
43 /* Get 'struct termios' and 'struct winsize'. */
46 # include <sys/ioctl.h>
48 /* Mingw lacks 'struct termios' and 'struct winsize', but a forward
49 declaration of an opaque type is sufficient to allow compilation of
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
56 /* The definition of _GL_WARN_ON_USE is copied here. */
59 /* Declare overridden functions. */
62 /* Create pseudo tty master slave pair and set terminal attributes
63 according to TERMP and WINP. Fork a child process attached to the
64 slave end. Return a handle for the master end in *AMASTER, and
65 return the name of the slave end in NAME. */
66 # if @REPLACE_FORKPTY@
67 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
69 # define forkpty rpl_forkpty
71 _GL_FUNCDECL_RPL (forkpty, int,
72 (int *amaster, char *name,
73 struct termios const *termp, struct winsize const *winp));
74 _GL_CXXALIAS_RPL (forkpty, int,
75 (int *amaster, char *name,
76 struct termios const *termp, struct winsize const *winp));
79 _GL_FUNCDECL_SYS (forkpty, int,
80 (int *amaster, char *name,
81 struct termios const *termp, struct winsize const *winp));
83 _GL_CXXALIAS_SYS (forkpty, int,
84 (int *amaster, char *name,
85 struct termios const *termp, struct winsize const *winp));
87 _GL_CXXALIASWARN (forkpty);
88 #elif defined GNULIB_POSIXCHECK
90 # if HAVE_RAW_DECL_FORKPTY
91 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
92 "use gnulib module forkpty for portability");
97 /* Create pseudo tty master slave pair and set terminal attributes
98 according to TERMP and WINP. Return handles for both ends in
99 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
100 # if @REPLACE_OPENPTY@
101 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 # define openpty rpl_openpty
105 _GL_FUNCDECL_RPL (openpty, int,
106 (int *amaster, int *aslave, char *name,
107 struct termios const *termp, struct winsize const *winp));
108 _GL_CXXALIAS_RPL (openpty, int,
109 (int *amaster, int *aslave, char *name,
110 struct termios const *termp, struct winsize const *winp));
113 _GL_FUNCDECL_SYS (openpty, int,
114 (int *amaster, int *aslave, char *name,
115 struct termios const *termp, struct winsize const *winp));
117 _GL_CXXALIAS_SYS (openpty, int,
118 (int *amaster, int *aslave, char *name,
119 struct termios const *termp, struct winsize const *winp));
121 _GL_CXXALIASWARN (openpty);
122 #elif defined GNULIB_POSIXCHECK
124 # if HAVE_RAW_DECL_OPENPTY
125 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
126 "use gnulib module openpty for portability");
131 #endif /* _@GUARD_PREFIX@_PTY_H */
132 #endif /* _@GUARD_PREFIX@_PTY_H */