1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-17 00:22:59 +00:00

Use tcgetattr/tcsetattr in termios code, not ioctl. (#43)

Previously, we were using ioctl directly on some platforms rather
than always going through termios. This complicates portability.
This commit is contained in:
Bruce Mitchener 2020-12-15 00:49:28 +07:00 committed by GitHub
parent 52d3590401
commit 20040a73b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,17 +165,9 @@ int ForkUnixShell(int slot, char ltr, char numb, char *termtype, char *shellarg)
kill processing, echo, backspace to erase, echo ctrl
chars as ^x, kill line by backspacing */
#if defined(MACOSX) || defined(FREEBSD)
tcgetattr(SlaveFD, &tio);
#else
ioctl(SlaveFD, TCGETS, (char *)&tio);
#endif
tio.c_lflag |= ICANON | ECHO | ECHOE | ECHOCTL | ECHOKE;
#if defined(MACOSX) || defined(FREEBSD)
tcsetattr(SlaveFD, TCSANOW, &tio);
#else
ioctl(SlaveFD, TCSETS, (char *)&tio);
#endif
#endif /* USETERMIOS */
(void)dup2(SlaveFD, 0);