| 1 |
/* Substitute for and wrapper around <termios.h>. |
| 2 |
Copyright (C) 2010-2026 Free Software Foundation, Inc. |
| 3 |
|
| 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. |
| 8 |
|
| 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. |
| 13 |
|
| 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/>. */ |
| 16 |
|
| 17 |
#ifndef _@GUARD_PREFIX@_TERMIOS_H |
| 18 |
|
| 19 |
#if __GNUC__ >= 3 |
| 20 |
@PRAGMA_SYSTEM_HEADER@ |
| 21 |
#endif |
| 22 |
@PRAGMA_COLUMNS@ |
| 23 |
|
| 24 |
/* On HP-UX 11.00, some of the function declarations in <sys/termio.h>, |
| 25 |
included by <termios.h>, are not protected by extern "C". Enforce |
| 26 |
"C" linkage for these functions nevertheless. */ |
| 27 |
#if defined __hpux && defined __cplusplus |
| 28 |
# include <sys/types.h> |
| 29 |
# include <sys/ioctl.h> |
| 30 |
extern "C" { |
| 31 |
# include <sys/termio.h> |
| 32 |
} |
| 33 |
#endif |
| 34 |
|
| 35 |
/* The include_next requires a split double-inclusion guard. */ |
| 36 |
#if @HAVE_TERMIOS_H@ |
| 37 |
# @INCLUDE_NEXT@ @NEXT_TERMIOS_H@ |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifndef _@GUARD_PREFIX@_TERMIOS_H |
| 41 |
#define _@GUARD_PREFIX@_TERMIOS_H |
| 42 |
|
| 43 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 44 |
#if !_GL_CONFIG_H_INCLUDED |
| 45 |
#error "Please include config.h first." |
| 46 |
#endif |
| 47 |
|
| 48 |
/* Get pid_t. */ |
| 49 |
#include <sys/types.h> |
| 50 |
|
| 51 |
#if ! @TERMIOS_H_DEFINES_STRUCT_WINSIZE@ |
| 52 |
/* On glibc. */ |
| 53 |
# if @SYS_IOCTL_H_DEFINES_STRUCT_WINSIZE@ |
| 54 |
# include <sys/ioctl.h> |
| 55 |
# else |
| 56 |
/* On Windows. */ |
| 57 |
# if !GNULIB_defined_struct_winsize |
| 58 |
struct winsize |
| 59 |
{ |
| 60 |
unsigned short ws_row; |
| 61 |
unsigned short ws_col; |
| 62 |
}; |
| 63 |
# define GNULIB_defined_struct_winsize 1 |
| 64 |
# endif |
| 65 |
# endif |
| 66 |
#endif |
| 67 |
|
| 68 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 69 |
|
| 70 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 71 |
|
| 72 |
|
| 73 |
/* Declare overridden functions. */ |
| 74 |
|
| 75 |
#if @GNULIB_TCGETSID@ |
| 76 |
/* Return the session ID of the controlling terminal of the current process. |
| 77 |
The argument is a descriptor if this controlling terminal. |
| 78 |
Return -1, with errno set, upon failure. errno = ENOSYS means that the |
| 79 |
function is unsupported. */ |
| 80 |
# if !@HAVE_DECL_TCGETSID@ |
| 81 |
_GL_FUNCDECL_SYS (tcgetsid, pid_t, (int fd), ); |
| 82 |
# endif |
| 83 |
_GL_CXXALIAS_SYS (tcgetsid, pid_t, (int fd)); |
| 84 |
_GL_CXXALIASWARN (tcgetsid); |
| 85 |
#elif defined GNULIB_POSIXCHECK |
| 86 |
# if HAVE_RAW_DECL_TCGETSID |
| 87 |
_GL_WARN_ON_USE (tcgetsid, "tcgetsid is not portable - " |
| 88 |
"use gnulib module tcgetsid for portability"); |
| 89 |
# endif |
| 90 |
#endif |
| 91 |
|
| 92 |
|
| 93 |
#endif /* _@GUARD_PREFIX@_TERMIOS_H */ |
| 94 |
#endif /* _@GUARD_PREFIX@_TERMIOS_H */ |