Anonymous
public text v1 · immutable int flags = fcntl(0, F_GETFL, 0);
int i, bit, h;
int fd = open("/dev/console", O_NONBLOCK);
if (fd < 0)
{
printf("attention: console still active!\n");
sleep(20);
/* not _deadly_ if we can't set graphics mode */
return;
}
ioctl(fd, KDSETMODE, KD_GRAPHICS);
close(fd);
fcntl(0, F_SETFL, flags | O_NONBLOCK);
ioctl(0, TCGETA, &savetty);
ioctl(0, TCGETA, &settty);
settty.c_lflag &= ~ICANON;
settty.c_lflag &= ~ECHO;
ioctl(0, TCSETAF, &settty);