1 /* Substitute for and wrapper around <pty.h>.
2 Copyright (C) 2010-2018 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, see <https://www.gnu.org/licenses/>. */
17 #ifndef _@GUARD_PREFIX@_PTY_H
20 @PRAGMA_SYSTEM_HEADER@
24 /* The include_next requires a split double-inclusion guard. */
26 # @INCLUDE_NEXT@ @NEXT_PTY_H@
29 #ifndef _@GUARD_PREFIX@_PTY_H
30 #define _@GUARD_PREFIX@_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 # include <sys/ioctl.h>
47 /* Mingw lacks 'struct termios' and 'struct winsize', but a forward
48 declaration of an opaque type is sufficient to allow compilation of
53 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
55 /* The definition of _GL_WARN_ON_USE is copied here. */
58 /* Declare overridden functions. */
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)
68 # define forkpty rpl_forkpty
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
));
78 _GL_FUNCDECL_SYS (forkpty
, int,
79 (int *amaster
, char *name
,
80 struct termios
const *termp
, struct winsize
const *winp
));
82 _GL_CXXALIAS_SYS (forkpty
, int,
83 (int *amaster
, char *name
,
84 struct termios
const *termp
, struct winsize
const *winp
));
86 _GL_CXXALIASWARN (forkpty
);
87 #elif defined GNULIB_POSIXCHECK
89 # if HAVE_RAW_DECL_FORKPTY
90 _GL_WARN_ON_USE (forkpty
, "forkpty is not declared consistently - "
91 "use gnulib module forkpty for portability");
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)
102 # define openpty rpl_openpty
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
));
112 _GL_FUNCDECL_SYS (openpty
, int,
113 (int *amaster
, int *aslave
, char *name
,
114 struct termios
const *termp
, struct winsize
const *winp
));
116 _GL_CXXALIAS_SYS (openpty
, int,
117 (int *amaster
, int *aslave
, char *name
,
118 struct termios
const *termp
, struct winsize
const *winp
));
120 _GL_CXXALIASWARN (openpty
);
121 #elif defined GNULIB_POSIXCHECK
123 # if HAVE_RAW_DECL_OPENPTY
124 _GL_WARN_ON_USE (openpty
, "openpty is not declared consistently - "
125 "use gnulib module openpty for portability");
130 #endif /* _@GUARD_PREFIX@_PTY_H */
131 #endif /* _@GUARD_PREFIX@_PTY_H */