1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

pty.c: Restore build on systems without cfmakeraw(3) (re: 5a2e7dae)

The OpenSUSE patch uses cfmakeraw(3) which is on Linux, BSD and
macOS, but not portable. The build failed on Solaris and variants.

src/cmd/builtin/features/pty:
- Add simple test for the presence of cfmakeraw(3). I love iffe.

src/cmd/builtin/pty.c:
- Add POSIX compliant fallback flaggery for systems without it.
This commit is contained in:
Martijn Dekker 2021-01-27 02:50:28 +00:00
parent 8e45daeaf1
commit 206bba4f2e
2 changed files with 8 additions and 0 deletions

View file

@ -236,7 +236,14 @@ mkpty(int* master, int* slave)
{
if (errno != ENOTTY)
error(-1, "unable to get standard error terminal attributes");
#if _lib_cfmakeraw
cfmakeraw(&tty);
#else
tty.c_iflag |= IGNPAR;
tty.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
tty.c_oflag &= ~OPOST;
tty.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL);
#endif /* _lib_cfmakeraw */
ttyp = 0;
}
tty.c_lflag |= ICANON | IEXTEN | ISIG | ECHO|ECHOE|ECHOK|ECHOKE;