2018-11-29 02:45:23 +00:00
|
|
|
#include <stdio.h>
|
2019-01-15 07:49:24 +00:00
|
|
|
#include <unistd.h>
|
2018-11-29 02:45:23 +00:00
|
|
|
#include <sys/ioctl.h>
|
2018-10-27 23:44:53 +00:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2018-11-09 09:18:04 +00:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
2018-11-29 02:45:23 +00:00
|
|
|
|
|
|
|
struct winsize ws;
|
2019-01-15 07:49:24 +00:00
|
|
|
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);
|
2018-11-29 02:45:23 +00:00
|
|
|
|
2018-10-27 23:44:53 +00:00
|
|
|
printf("Counting to 100000: \033[s");
|
|
|
|
for (unsigned i = 0; i <= 100000; ++i) {
|
|
|
|
printf("\033[u\033[s%u", i);
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
return 0;
|
|
|
|
}
|