mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-01 03:53:33 +00:00
868af3f950
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.
61 lines
2.9 KiB
C
61 lines
2.9 KiB
C
#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 ─╬─│┼
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
|
|
int tcgetattr(int, struct termios *);
|
|
int tcsetattr(int, int, const struct termios *);
|
|
int tcsetpgrp(int, int32_t);
|
|
int32_t tcgetpgrp(int);
|
|
|
|
int openpty(int *, int *, char *, const struct termios *,
|
|
const struct winsize *) paramsnonnull((1, 2)) dontdiscard;
|
|
int forkpty(int *, char *, const struct termios *, const struct winsize *)
|
|
paramsnonnull((1, 2)) dontdiscard;
|
|
errno_t ptsname_r(int, char *, size_t);
|
|
|
|
int grantpt(int);
|
|
int unlockpt(int);
|
|
int posix_openpt(int) dontdiscard;
|
|
|
|
int tcdrain(int);
|
|
int tcgetsid(int);
|
|
int tcflow(int, int);
|
|
int tcflush(int, int);
|
|
int tcsendbreak(int, int);
|
|
void cfmakeraw(struct termios *);
|
|
int cfsetospeed(struct termios *, int);
|
|
int cfsetispeed(struct termios *, int);
|
|
uint32_t cfgetospeed(const struct termios *);
|
|
uint32_t cfgetispeed(const struct termios *);
|
|
|
|
/*───────────────────────────────────────────────────────────────────────────│─╗
|
|
│ cosmopolitan § teletypewriter » undiamonding ─╬─│┼
|
|
╚────────────────────────────────────────────────────────────────────────────│*/
|
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
|
|
|
#define tcsetattr(FD, OPT, TIO) tcsetattr_dispatch(FD, OPT, TIO)
|
|
forceinline int tcsetattr_dispatch(int fd, int opt, const struct termios *tio) {
|
|
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);
|
|
return (tcsetattr)(fd, opt, tio);
|
|
}
|
|
|
|
#define tcgetattr(FD, TIO) tcgetattr_dispatch(FD, TIO)
|
|
forceinline int tcgetattr_dispatch(int fd, const struct termios *tio) {
|
|
return ioctl(fd, TCGETS, (void *)tio);
|
|
}
|
|
|
|
#endif /* GNUC && !ANSI */
|
|
COSMOPOLITAN_C_END_
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_ */
|