annotate lib/pty.in.h @ 16201:8250f2777afc

maint: update all copyright year number ranges Run "make update-copyright".
author Jim Meyering <meyering@redhat.com>
date Sun, 01 Jan 2012 10:04:58 +0100
parents 7ecf82aec60c
children bb182ee4a09d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
1 /* Substitute for and wrapper around <pty.h>.
16201
8250f2777afc maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents: 16065
diff changeset
2 Copyright (C) 2010-2012 Free Software Foundation, Inc.
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
3
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
7 any later version.
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
8
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
12 GNU General Public License for more details.
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
13
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
17
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
18 #ifndef _@GUARD_PREFIX@_PTY_H
13094
2ed0fc659db8 Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents: 13055
diff changeset
19
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
20 #if __GNUC__ >= 3
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
21 @PRAGMA_SYSTEM_HEADER@
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
22 #endif
13761
a19ace3ba849 Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents: 13662
diff changeset
23 @PRAGMA_COLUMNS@
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
24
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
25 /* The include_next requires a split double-inclusion guard. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
26 #if @HAVE_PTY_H@
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
27 # @INCLUDE_NEXT@ @NEXT_PTY_H@
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
28 #endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
29
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
30 #ifndef _@GUARD_PREFIX@_PTY_H
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
31 #define _@GUARD_PREFIX@_PTY_H
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
32
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
33 /* Some platforms declare this in a different header than glibc. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
34 #if @HAVE_UTIL_H@
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
35 # include <util.h>
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
36 #endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
37 #if @HAVE_LIBUTIL_H@
13662
4cbe1ae13867 pty, readutmp: Fix for FreeBSD 8.0 and OpenBSD 4.6.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
38 /* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
4cbe1ae13867 pty, readutmp: Fix for FreeBSD 8.0 and OpenBSD 4.6.
Bruno Haible <bruno@clisp.org>
parents: 13094
diff changeset
39 # include <sys/types.h>
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
40 # include <libutil.h>
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
41 #endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
42
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
43 /* Get 'struct termios' and 'struct winsize'. */
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
44 #include <termios.h>
15978
da5b835b2356 openpty: Avoid compilation error on AIX 6.1.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
45 #if defined _AIX
da5b835b2356 openpty: Avoid compilation error on AIX 6.1.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
46 # include <sys/ioctl.h>
da5b835b2356 openpty: Avoid compilation error on AIX 6.1.
Bruno Haible <bruno@clisp.org>
parents: 14840
diff changeset
47 #endif
16065
7ecf82aec60c openpty: provide a stub on mingw
Eric Blake <eblake@redhat.com>
parents: 15978
diff changeset
48 /* Mingw lacks 'struct termios' and 'struct winsize', but a forward
7ecf82aec60c openpty: provide a stub on mingw
Eric Blake <eblake@redhat.com>
parents: 15978
diff changeset
49 declaration of an opaque type is sufficient to allow compilation of
7ecf82aec60c openpty: provide a stub on mingw
Eric Blake <eblake@redhat.com>
parents: 15978
diff changeset
50 a stub openpty(). */
7ecf82aec60c openpty: provide a stub on mingw
Eric Blake <eblake@redhat.com>
parents: 15978
diff changeset
51 struct termios;
7ecf82aec60c openpty: provide a stub on mingw
Eric Blake <eblake@redhat.com>
parents: 15978
diff changeset
52 struct winsize;
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
53
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
55
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
56 /* The definition of _GL_WARN_ON_USE is copied here. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
57
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
58
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
59 /* Declare overridden functions. */
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
60
13005
9bc579132d24 forkpty, openpty: split functions into new modules
Eric Blake <eblake@redhat.com>
parents: 13004
diff changeset
61 #if @GNULIB_FORKPTY@
13040
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
62 /* Create pseudo tty master slave pair and set terminal attributes
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
63 according to TERMP and WINP. Fork a child process attached to the
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
64 slave end. Return a handle for the master end in *AMASTER, and
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
65 return the name of the slave end in NAME. */
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
66 # if @REPLACE_FORKPTY@
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
67 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
68 # undef forkpty
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
69 # define forkpty rpl_forkpty
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
70 # endif
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
71 _GL_FUNCDECL_RPL (forkpty, int,
13040
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
72 (int *amaster, char *name,
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
73 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
74 _GL_CXXALIAS_RPL (forkpty, int,
13040
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
75 (int *amaster, char *name,
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
76 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
77 # else
13040
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
78 # if !@HAVE_FORKPTY@
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
79 _GL_FUNCDECL_SYS (forkpty, int,
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
80 (int *amaster, char *name,
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
81 struct termios const *termp, struct winsize const *winp));
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
82 # endif
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
83 _GL_CXXALIAS_SYS (forkpty, int,
13040
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
84 (int *amaster, char *name,
320f40c27bf5 forkpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13032
diff changeset
85 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
86 # endif
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
87 _GL_CXXALIASWARN (forkpty);
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
88 #elif defined GNULIB_POSIXCHECK
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
89 # undef forkpty
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
90 # if HAVE_RAW_DECL_FORKPTY
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
91 _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
13005
9bc579132d24 forkpty, openpty: split functions into new modules
Eric Blake <eblake@redhat.com>
parents: 13004
diff changeset
92 "use gnulib module forkpty for portability");
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
93 # endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
94 #endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
95
13005
9bc579132d24 forkpty, openpty: split functions into new modules
Eric Blake <eblake@redhat.com>
parents: 13004
diff changeset
96 #if @GNULIB_OPENPTY@
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
97 /* Create pseudo tty master slave pair and set terminal attributes
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
98 according to TERMP and WINP. Return handles for both ends in
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
99 *AMASTER and *ASLAVE, and return the name of the slave end in NAME. */
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
100 # if @REPLACE_OPENPTY@
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
101 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
102 # undef openpty
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
103 # define openpty rpl_openpty
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
104 # endif
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
105 _GL_FUNCDECL_RPL (openpty, int,
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
106 (int *amaster, int *aslave, char *name,
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
107 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
108 _GL_CXXALIAS_RPL (openpty, int,
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
109 (int *amaster, int *aslave, char *name,
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
110 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
111 # else
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
112 # if !@HAVE_OPENPTY@
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
113 _GL_FUNCDECL_SYS (openpty, int,
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
114 (int *amaster, int *aslave, char *name,
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
115 struct termios const *termp, struct winsize const *winp));
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
116 # endif
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
117 _GL_CXXALIAS_SYS (openpty, int,
13032
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
118 (int *amaster, int *aslave, char *name,
64faceabf217 openpty: Provide replacement on AIX, HP-UX, IRIX, Solaris.
Bruno Haible <bruno@clisp.org>
parents: 13006
diff changeset
119 struct termios const *termp, struct winsize const *winp));
13006
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
120 # endif
b89998923de3 forkpty, openpty: prefer glibc's const-safe prototype
Eric Blake <eblake@redhat.com>
parents: 13005
diff changeset
121 _GL_CXXALIASWARN (openpty);
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
122 #elif defined GNULIB_POSIXCHECK
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
123 # undef openpty
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
124 # if HAVE_RAW_DECL_OPENPTY
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
125 _GL_WARN_ON_USE (openpty, "openpty is not declared consistently - "
13005
9bc579132d24 forkpty, openpty: split functions into new modules
Eric Blake <eblake@redhat.com>
parents: 13004
diff changeset
126 "use gnulib module openpty for portability");
13004
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
127 # endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
128 #endif
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
129
fc24abfe059f pty: improve replacement header
Eric Blake <eblake@redhat.com>
parents:
diff changeset
130
14840
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
131 #endif /* _@GUARD_PREFIX@_PTY_H */
5f709022a256 Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
132 #endif /* _@GUARD_PREFIX@_PTY_H */