ladybird/Userland/tst.cpp

25 lines
522 B
C++
Raw Normal View History

#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;
}