(re)set the controlling terminal.

This is necessary to read input from the console (via the Event Manager) since opening a pseudo terminal screws up the controlling terminal (and there is no O_NOCTTY flag).
This commit is contained in:
Kelvin Sherlock 2019-10-03 00:05:21 -04:00
parent d77291a0c0
commit 4da75367c1
2 changed files with 11 additions and 1 deletions

View File

@ -19,7 +19,7 @@ marlene: $(MARLENE_OBJS) $(COMMON_OBJS)
darlene: $(DARLENE_OBJS) $(COMMON_OBJS)
$(CC) -lutil -o $@ $^
iix chtyp -a 0xdc00 $@
# iix chtyp -a 0xdc00 $@

View File

@ -192,6 +192,11 @@ int main(int argc, char **argv) {
return 1;
}
if (!isatty(STDIN_FILENO)) {
ErrWriteCString("stdin required.\r\n");
return 1;
}
term_var.value = "\x05\x00vt100";
child_argv = NULL;
for (i = 1; i < argc; ++i) {
@ -260,6 +265,11 @@ int main(int argc, char **argv) {
goto _exit;
}
/* reset the controlling terminal, which was clobbered by opening a pty */
/* standard TIOCSCTTY causes ORCA/C shift errors */
#undef TIOCSCTTY
#define TIOCSCTTY (0x20000000ul | ('t' << 8) | 97)
ioctl(STDIN_FILENO, TIOCSCTTY, (void *)0);
for(;;) {