Debian Codegraph @

lib/pty.in.h

raw
1 /* Substitute for and wrapper around <pty.h>.
2 Copyright (C) 2010-2026 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file 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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://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 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
33 #if !_GL_CONFIG_H_INCLUDED
34 #error "Please include config.h first."
35 #endif
36
37 /* Some platforms declare this in a different header than glibc. */
38 #if @HAVE_UTIL_H@
39 # include <util.h>
40 #endif
41 #if @HAVE_LIBUTIL_H@
42 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
43 # include <sys/types.h>
44 # include <libutil.h>
45 #endif
46
47 /* Get 'struct termios', if available, and 'struct winsize'. */
48 #include <termios.h>
49 #if defined _AIX
50 # include <sys/ioctl.h>
51 #endif
52 /* Mingw lacks 'struct termios', but a forward declaration of an opaque type is
53 sufficient to allow compilation of a stub openpty(). */
54 struct termios;
55
56 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
57
58 /* The definition of _GL_WARN_ON_USE is copied here. */
59
60
61 /* Declare overridden functions. */
62
63 #if @GNULIB_FORKPTY@
64 /* Create pseudo tty master slave pair and set terminal attributes
65 according to TERMP and WINP. Fork a child process attached to the
66 slave end. Return a handle for the master end in *AMASTER, and
67 return the name of the slave end in NAME. */
68 # if @REPLACE_FORKPTY@
69 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
70 # undef forkpty
71 # define forkpty rpl_forkpty
72 # endif
73 _GL_FUNCDECL_RPL (forkpty, int,
74 (int *amaster, char *name,
75 struct termios const *termp, struct winsize const *winp), );
76 _GL_CXXALIAS_RPL (forkpty, int,
77 (int *amaster, char *name,
78 struct termios const *termp, struct winsize const *winp));
79 # else
80 # if !@HAVE_FORKPTY@
81 _GL_FUNCDECL_SYS (forkpty, int,
82 (int *amaster, char *name,
83 struct termios const *termp, struct winsize const *winp), );
84 # endif
85 _GL_CXXALIAS_SYS (forkpty, int,
86 (int *amaster, char *name,
87 struct termios const *termp, struct winsize const *winp));
88 # endif
89 _GL_CXXALIASWARN (forkpty);
90 #elif defined GNULIB_POSIXCHECK
91 # if HAVE_RAW_DECL_FORKPTY
92 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
93 "use gnulib module forkpty for portability");
94 # endif
95 #endif
96
97 #if @GNULIB_OPENPTY@
98 /* Create pseudo tty master slave pair and set terminal attributes
99 according to TERMP and WINP. Return handles for both ends in
100 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
101 # if @REPLACE_OPENPTY@
102 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 # undef openpty
104 # define openpty rpl_openpty
105 # endif
106 _GL_FUNCDECL_RPL (openpty, int,
107 (int *amaster, int *aslave, char *name,
108 struct termios const *termp, struct winsize const *winp), );
109 _GL_CXXALIAS_RPL (openpty, int,
110 (int *amaster, int *aslave, char *name,
111 struct termios const *termp, struct winsize const *winp));
112 # else
113 # if !@HAVE_OPENPTY@
114 _GL_FUNCDECL_SYS (openpty, int,
115 (int *amaster, int *aslave, char *name,
116 struct termios const *termp, struct winsize const *winp), );
117 # endif
118 _GL_CXXALIAS_SYS (openpty, int,
119 (int *amaster, int *aslave, char *name,
120 struct termios const *termp, struct winsize const *winp));
121 # endif
122 _GL_CXXALIASWARN (openpty);
123 #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");
127 # endif
128 #endif
129
130
131 #endif /* _@GUARD_PREFIX@_PTY_H */
132 #endif /* _@GUARD_PREFIX@_PTY_H */