Mercurial > hg > octave-shane > gnulib-hg
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 |
rev | line source |
---|---|
13004 | 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 | 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 | |
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 | 20 #if __GNUC__ >= 3 |
21 @PRAGMA_SYSTEM_HEADER@ | |
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 | 24 |
25 /* The include_next requires a split double-inclusion guard. */ | |
26 #if @HAVE_PTY_H@ | |
27 # @INCLUDE_NEXT@ @NEXT_PTY_H@ | |
28 #endif | |
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 | 32 |
33 /* Some platforms declare this in a different header than glibc. */ | |
34 #if @HAVE_UTIL_H@ | |
35 # include <util.h> | |
36 #endif | |
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 | 40 # include <libutil.h> |
41 #endif | |
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 | 54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
55 | |
56 /* The definition of _GL_WARN_ON_USE is copied here. */ | |
57 | |
58 | |
59 /* Declare overridden functions. */ | |
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 | 88 #elif defined GNULIB_POSIXCHECK |
89 # undef forkpty | |
90 # if HAVE_RAW_DECL_FORKPTY | |
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 | 93 # endif |
94 #endif | |
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 | 122 #elif defined GNULIB_POSIXCHECK |
123 # undef openpty | |
124 # if HAVE_RAW_DECL_OPENPTY | |
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 | 127 # endif |
128 #endif | |
129 | |
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 */ |