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. */
21 @PRAGMA_SYSTEM_HEADER@
25 /* The include_next requires a split double-inclusion guard. */
27 # @INCLUDE_NEXT@ @NEXT_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 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
48 /* The definition of _GL_WARN_ON_USE is copied here. */
51 /* Declare overridden functions. */
54 /* Create pseudo tty master slave pair and set terminal attributes
55 according to TERMP and WINP. Fork a child process attached to the
56 slave end. Return a handle for the master end in *AMASTER, and
57 return the name of the slave end in NAME. */
58 # if @REPLACE_FORKPTY@
59 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
61 # define forkpty rpl_forkpty
63 _GL_FUNCDECL_RPL (forkpty, int,
64 (int *amaster, char *name,
65 struct termios const *termp, struct winsize const *winp));
66 _GL_CXXALIAS_RPL (forkpty, int,
67 (int *amaster, char *name,
68 struct termios const *termp, struct winsize const *winp));
71 _GL_FUNCDECL_SYS (forkpty, int,
72 (int *amaster, char *name,
73 struct termios const *termp, struct winsize const *winp));
75 _GL_CXXALIAS_SYS (forkpty, int,
76 (int *amaster, char *name,
77 struct termios const *termp, struct winsize const *winp));
79 _GL_CXXALIASWARN (forkpty);
80 #elif defined GNULIB_POSIXCHECK
82 # if HAVE_RAW_DECL_FORKPTY
83 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
84 "use gnulib module forkpty for portability");
89 /* Create pseudo tty master slave pair and set terminal attributes
90 according to TERMP and WINP. Return handles for both ends in
91 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
92 # if @REPLACE_OPENPTY@
93 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
95 # define openpty rpl_openpty
97 _GL_FUNCDECL_RPL (openpty, int,
98 (int *amaster, int *aslave, char *name,
99 struct termios const *termp, struct winsize const *winp));
100 _GL_CXXALIAS_RPL (openpty, int,
101 (int *amaster, int *aslave, char *name,
102 struct termios const *termp, struct winsize const *winp));
105 _GL_FUNCDECL_SYS (openpty, int,
106 (int *amaster, int *aslave, char *name,
107 struct termios const *termp, struct winsize const *winp));
109 _GL_CXXALIAS_SYS (openpty, int,
110 (int *amaster, int *aslave, char *name,
111 struct termios const *termp, struct winsize const *winp));
113 _GL_CXXALIASWARN (openpty);
114 #elif defined GNULIB_POSIXCHECK
116 # if HAVE_RAW_DECL_OPENPTY
117 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
118 "use gnulib module openpty for portability");
123 #endif /* _GL_PTY_H */
124 #endif /* _GL_PTY_H */