pthread: Add enough so that coreutils/src/sort.c compiles.
[gnulib.git] / lib / pty.in.h
1 /* Substitute for and wrapper around <pty.h>.
2    Copyright (C) 2010 Free Software Foundation, Inc.
3
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)
7    any later version.
8
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.
13
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.  */
17
18 #ifndef _GL_PTY_H
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
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 _GL_PTY_H
30 #define _GL_PTY_H
31
32 /* Some platforms declare this in a different header than glibc.  */
33 #if @HAVE_UTIL_H@
34 # include <util.h>
35 #endif
36 #if @HAVE_LIBUTIL_H@
37 # include <libutil.h>
38 #endif
39
40 /* Get 'struct termios' and 'struct winsize'.  */
41 #include <termios.h>
42
43 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
44
45 /* The definition of _GL_WARN_ON_USE is copied here.  */
46
47
48 /* Declare overridden functions.  */
49
50 #if @GNULIB_FORKPTY@
51 /* Create pseudo tty master slave pair and set terminal attributes
52    according to TERMP and WINP.  Fork a child process attached to the
53    slave end.  Return a handle for the master end in *AMASTER, and
54    return the name of the slave end in NAME.  */
55 # if @REPLACE_FORKPTY@
56 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
57 #   undef forkpty
58 #   define forkpty rpl_forkpty
59 #  endif
60 _GL_FUNCDECL_RPL (forkpty, int,
61                   (int *amaster, char *name,
62                    struct termios const *termp, struct winsize const *winp));
63 _GL_CXXALIAS_RPL (forkpty, int,
64                   (int *amaster, char *name,
65                    struct termios const *termp, struct winsize const *winp));
66 # else
67 #  if !@HAVE_FORKPTY@
68 _GL_FUNCDECL_SYS (forkpty, int,
69                   (int *amaster, char *name,
70                    struct termios const *termp, struct winsize const *winp));
71 #  endif
72 _GL_CXXALIAS_SYS (forkpty, int,
73                   (int *amaster, char *name,
74                    struct termios const *termp, struct winsize const *winp));
75 # endif
76 _GL_CXXALIASWARN (forkpty);
77 #elif defined GNULIB_POSIXCHECK
78 # undef forkpty
79 # if HAVE_RAW_DECL_FORKPTY
80 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
81                  "use gnulib module forkpty for portability");
82 # endif
83 #endif
84
85 #if @GNULIB_OPENPTY@
86 /* Create pseudo tty master slave pair and set terminal attributes
87    according to TERMP and WINP.  Return handles for both ends in
88    *AMASTER and *ASLAVE, and return the name of the slave end in NAME.  */
89 # if @REPLACE_OPENPTY@
90 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
91 #   undef openpty
92 #   define openpty rpl_openpty
93 #  endif
94 _GL_FUNCDECL_RPL (openpty, int,
95                   (int *amaster, int *aslave, char *name,
96                    struct termios const *termp, struct winsize const *winp));
97 _GL_CXXALIAS_RPL (openpty, int,
98                   (int *amaster, int *aslave, char *name,
99                    struct termios const *termp, struct winsize const *winp));
100 # else
101 #  if !@HAVE_OPENPTY@
102 _GL_FUNCDECL_SYS (openpty, int,
103                   (int *amaster, int *aslave, char *name,
104                    struct termios const *termp, struct winsize const *winp));
105 #  endif
106 _GL_CXXALIAS_SYS (openpty, int,
107                   (int *amaster, int *aslave, char *name,
108                    struct termios const *termp, struct winsize const *winp));
109 # endif
110 _GL_CXXALIASWARN (openpty);
111 #elif defined GNULIB_POSIXCHECK
112 # undef openpty
113 # if HAVE_RAW_DECL_OPENPTY
114 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
115                  "use gnulib module openpty for portability");
116 # endif
117 #endif
118
119
120 #endif /* _GL_PTY_H */
121 #endif /* _GL_PTY_H */