exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / pty.in.h
blob37470cb63dcda711800eab6517db9db26525e748
1 /* Substitute for and wrapper around <pty.h>.
2 Copyright (C) 2010-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #ifndef _@GUARD_PREFIX@_PTY_H
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
24 /* The include_next requires a split double-inclusion guard. */
25 #if @HAVE_PTY_H@
26 # @INCLUDE_NEXT@ @NEXT_PTY_H@
27 #endif
29 #ifndef _@GUARD_PREFIX@_PTY_H
30 #define _@GUARD_PREFIX@_PTY_H
32 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
33 #if !_GL_CONFIG_H_INCLUDED
34 #error "Please include config.h first."
35 #endif
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
47 /* Get 'struct termios' and 'struct winsize'. */
48 #include <termios.h>
49 #if defined _AIX
50 # include <sys/ioctl.h>
51 #endif
52 /* Mingw lacks 'struct termios' and 'struct winsize', but a forward
53 declaration of an opaque type is sufficient to allow compilation of
54 a stub openpty(). */
55 struct termios;
56 struct winsize;
58 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
60 /* The definition of _GL_WARN_ON_USE is copied here. */
63 /* Declare overridden functions. */
65 #if @GNULIB_FORKPTY@
66 /* Create pseudo tty master slave pair and set terminal attributes
67 according to TERMP and WINP. Fork a child process attached to the
68 slave end. Return a handle for the master end in *AMASTER, and
69 return the name of the slave end in NAME. */
70 # if @REPLACE_FORKPTY@
71 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
72 # undef forkpty
73 # define forkpty rpl_forkpty
74 # endif
75 _GL_FUNCDECL_RPL (forkpty, int,
76 (int *amaster, char *name,
77 struct termios const *termp, struct winsize const *winp));
78 _GL_CXXALIAS_RPL (forkpty, int,
79 (int *amaster, char *name,
80 struct termios const *termp, struct winsize const *winp));
81 # else
82 # if !@HAVE_FORKPTY@
83 _GL_FUNCDECL_SYS (forkpty, int,
84 (int *amaster, char *name,
85 struct termios const *termp, struct winsize const *winp));
86 # endif
87 _GL_CXXALIAS_SYS (forkpty, int,
88 (int *amaster, char *name,
89 struct termios const *termp, struct winsize const *winp));
90 # endif
91 _GL_CXXALIASWARN (forkpty);
92 #elif defined GNULIB_POSIXCHECK
93 # undef forkpty
94 # if HAVE_RAW_DECL_FORKPTY
95 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
96 "use gnulib module forkpty for portability");
97 # endif
98 #endif
100 #if @GNULIB_OPENPTY@
101 /* Create pseudo tty master slave pair and set terminal attributes
102 according to TERMP and WINP. Return handles for both ends in
103 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
104 # if @REPLACE_OPENPTY@
105 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
106 # undef openpty
107 # define openpty rpl_openpty
108 # endif
109 _GL_FUNCDECL_RPL (openpty, int,
110 (int *amaster, int *aslave, char *name,
111 struct termios const *termp, struct winsize const *winp));
112 _GL_CXXALIAS_RPL (openpty, int,
113 (int *amaster, int *aslave, char *name,
114 struct termios const *termp, struct winsize const *winp));
115 # else
116 # if !@HAVE_OPENPTY@
117 _GL_FUNCDECL_SYS (openpty, int,
118 (int *amaster, int *aslave, char *name,
119 struct termios const *termp, struct winsize const *winp));
120 # endif
121 _GL_CXXALIAS_SYS (openpty, int,
122 (int *amaster, int *aslave, char *name,
123 struct termios const *termp, struct winsize const *winp));
124 # endif
125 _GL_CXXALIASWARN (openpty);
126 #elif defined GNULIB_POSIXCHECK
127 # undef openpty
128 # if HAVE_RAW_DECL_OPENPTY
129 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
130 "use gnulib module openpty for portability");
131 # endif
132 #endif
135 #endif /* _@GUARD_PREFIX@_PTY_H */
136 #endif /* _@GUARD_PREFIX@_PTY_H */