ladybird/Userland/tst.cpp
Andreas Kling 49b63281a0 Make it possible for a process to switch controlling terminals.
Via the TIOCSCTTY and TIOCNOTTY ioctls.
2019-01-15 08:49:24 +01:00

25 lines
522 B
C++

#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
int main(int argc, char** argv)
{
(void) argc;
(void) argv;
struct winsize ws;
int rc = ioctl(0, TIOCGWINSZ, &ws);
if (rc < 0) {
perror("ioctl(TIOCGWINSZ)");
}
printf("TTY is %s\n", ttyname(0));
printf("Terminal size is %ux%u\n", ws.ws_col, ws.ws_row);
printf("Counting to 100000: \033[s");
for (unsigned i = 0; i <= 100000; ++i) {
printf("\033[u\033[s%u", i);
}
printf("\n");
return 0;
}