mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
49b63281a0
Via the TIOCSCTTY and TIOCNOTTY ioctls.
24 lines
522 B
C++
24 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;
|
|
}
|