1 /* Support functions related to (pseudo)terminals.
2    Copyright (C) 2018-2022 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _SUPPORT_TTY_H
20 #define _SUPPORT_TTY_H 1
21 
22 struct termios;
23 struct winsize;
24 
25 /** Open a pseudoterminal pair.  The outer fd is written to the address
26     A_OUTER and the inner fd to A_INNER.
27 
28     If A_NAME is not NULL, it will be set to point to a string naming
29     the /dev/pts/NNN device corresponding to the inner fd; space for
30     this string is allocated with malloc and should be freed by the
31     caller when no longer needed.  (This is different from the libutil
32     function 'openpty'.)
33 
34     If TERMP is not NULL, the terminal parameters will be initialized
35     according to the termios structure it points to.
36 
37     If WINP is not NULL, the terminal window size will be set
38     accordingly.
39 
40     Terminates the process on failure (like xmalloc).  */
41 extern void support_openpty (int *a_outer, int *a_inner, char **a_name,
42                              const struct termios *termp,
43                              const struct winsize *winp);
44 
45 #endif
46