You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
513 B
D
27 lines
513 B
D
import core.stdc.errno;
|
|
import core.stdc.stdio;
|
|
import core.stdc.stdlib;
|
|
import core.sys.posix.fcntl;
|
|
import core.sys.posix.signal;
|
|
import core.sys.posix.sys.ioctl;
|
|
import core.sys.posix.unistd;
|
|
|
|
extern(C) void handle_sigwinch() {
|
|
printf("terminal has been resized");
|
|
}
|
|
|
|
extern(C) int main(int argc, char **argv) {
|
|
winsize ws;
|
|
|
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
|
|
signal(SIGWINCH, handle_sigwinch);
|
|
|
|
printf("Lines: %d\n", ws.ws_row);
|
|
printf("Columns %d\n", ws.ws_col);
|
|
|
|
while (true) {
|
|
}
|
|
|
|
return 0;
|
|
}
|