1 /* Substitute for and wrapper around <pty.h>.
2 Copyright (C) 2010 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@
24 /* The include_next requires a split double-inclusion guard. */
26 # @INCLUDE_NEXT@ @NEXT_PTY_H@
32 /* Some platforms declare this in a different header than glibc. */
37 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
38 # include <sys/types.h>
42 /* Get 'struct termios' and 'struct winsize'. */
45 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
47 /* The definition of _GL_WARN_ON_USE is copied here. */
50 /* Declare overridden functions. */
53 /* Create pseudo tty master slave pair and set terminal attributes
54 according to TERMP and WINP. Fork a child process attached to the
55 slave end. Return a handle for the master end in *AMASTER, and
56 return the name of the slave end in NAME. */
57 # if @REPLACE_FORKPTY@
58 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
60 # define forkpty rpl_forkpty
62 _GL_FUNCDECL_RPL (forkpty, int,
63 (int *amaster, char *name,
64 struct termios const *termp, struct winsize const *winp));
65 _GL_CXXALIAS_RPL (forkpty, int,
66 (int *amaster, char *name,
67 struct termios const *termp, struct winsize const *winp));
70 _GL_FUNCDECL_SYS (forkpty, int,
71 (int *amaster, char *name,
72 struct termios const *termp, struct winsize const *winp));
74 _GL_CXXALIAS_SYS (forkpty, int,
75 (int *amaster, char *name,
76 struct termios const *termp, struct winsize const *winp));
78 _GL_CXXALIASWARN (forkpty);
79 #elif defined GNULIB_POSIXCHECK
81 # if HAVE_RAW_DECL_FORKPTY
82 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
83 "use gnulib module forkpty for portability");
88 /* Create pseudo tty master slave pair and set terminal attributes
89 according to TERMP and WINP. Return handles for both ends in
90 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
91 # if @REPLACE_OPENPTY@
92 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
94 # define openpty rpl_openpty
96 _GL_FUNCDECL_RPL (openpty, int,
97 (int *amaster, int *aslave, char *name,
98 struct termios const *termp, struct winsize const *winp));
99 _GL_CXXALIAS_RPL (openpty, int,
100 (int *amaster, int *aslave, char *name,
101 struct termios const *termp, struct winsize const *winp));
104 _GL_FUNCDECL_SYS (openpty, int,
105 (int *amaster, int *aslave, char *name,
106 struct termios const *termp, struct winsize const *winp));
108 _GL_CXXALIAS_SYS (openpty, int,
109 (int *amaster, int *aslave, char *name,
110 struct termios const *termp, struct winsize const *winp));
112 _GL_CXXALIASWARN (openpty);
113 #elif defined GNULIB_POSIXCHECK
115 # if HAVE_RAW_DECL_OPENPTY
116 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
117 "use gnulib module openpty for portability");
122 #endif /* _GL_PTY_H */
123 #endif /* _GL_PTY_H */