blob: bea9c63e611946fb6a84c55c8b7e8610bfb126a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#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;
}
|