2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_
|
|
|
|
#include "libc/calls/ioctl.h"
|
|
|
|
#include "libc/calls/struct/termios.h"
|
|
|
|
#include "libc/calls/struct/winsize.h"
|
|
|
|
#include "libc/sysv/consts/termios.h"
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
|
|
│ cosmopolitan § teletypewriter control ─╬─│┼
|
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
int tcgetattr(int, struct termios *);
|
|
|
|
int tcsetattr(int, int, const struct termios *);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
int openpty(int *, int *, char *, const struct termios *,
|
2022-07-22 13:58:36 +00:00
|
|
|
const struct winsize *) paramsnonnull((1, 2));
|
2020-06-15 14:18:57 +00:00
|
|
|
int forkpty(int *, char *, const struct termios *, const struct winsize *)
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
paramsnonnull((1, 2)) dontdiscard;
|
2022-07-20 04:18:33 +00:00
|
|
|
char *ptsname(int);
|
2020-06-15 14:18:57 +00:00
|
|
|
errno_t ptsname_r(int, char *, size_t);
|
|
|
|
|
|
|
|
int grantpt(int);
|
|
|
|
int unlockpt(int);
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
int posix_openpt(int) dontdiscard;
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-08-12 07:42:14 +00:00
|
|
|
int tcdrain(int);
|
|
|
|
int tcgetsid(int);
|
|
|
|
int tcflow(int, int);
|
|
|
|
int tcflush(int, int);
|
|
|
|
int tcsendbreak(int, int);
|
|
|
|
void cfmakeraw(struct termios *);
|
2022-10-11 00:52:41 +00:00
|
|
|
int cfsetospeed(struct termios *, unsigned);
|
|
|
|
int cfsetispeed(struct termios *, unsigned);
|
2021-08-12 07:42:14 +00:00
|
|
|
uint32_t cfgetospeed(const struct termios *);
|
|
|
|
uint32_t cfgetispeed(const struct termios *);
|
2023-01-20 17:25:45 +00:00
|
|
|
int tcsetwinsize(int, const struct winsize *);
|
|
|
|
int tcgetwinsize(int, struct winsize *);
|
2021-08-12 07:42:14 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
2020-06-21 07:10:11 +00:00
|
|
|
│ cosmopolitan § teletypewriter » undiamonding ─╬─│┼
|
2020-06-15 14:18:57 +00:00
|
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
2020-06-21 07:10:11 +00:00
|
|
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2021-02-06 08:24:35 +00:00
|
|
|
#define tcsetattr(FD, OPT, TIO) tcsetattr_dispatch(FD, OPT, TIO)
|
|
|
|
forceinline int tcsetattr_dispatch(int fd, int opt, const struct termios *tio) {
|
2021-03-01 07:42:35 +00:00
|
|
|
if (__EQUIVALENT(opt, TCSANOW)) return ioctl(fd, TCSETS, (void *)tio);
|
|
|
|
if (__EQUIVALENT(opt, TCSADRAIN)) return ioctl(fd, TCSETSW, (void *)tio);
|
|
|
|
if (__EQUIVALENT(opt, TCSAFLUSH)) return ioctl(fd, TCSETSF, (void *)tio);
|
2020-06-15 14:18:57 +00:00
|
|
|
return (tcsetattr)(fd, opt, tio);
|
|
|
|
}
|
|
|
|
|
2021-02-06 08:24:35 +00:00
|
|
|
#define tcgetattr(FD, TIO) tcgetattr_dispatch(FD, TIO)
|
|
|
|
forceinline int tcgetattr_dispatch(int fd, const struct termios *tio) {
|
2020-06-15 14:18:57 +00:00
|
|
|
return ioctl(fd, TCGETS, (void *)tio);
|
|
|
|
}
|
|
|
|
|
2020-06-21 07:10:11 +00:00
|
|
|
#endif /* GNUC && !ANSI */
|
2020-06-15 14:18:57 +00:00
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_ */
|