summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'console.c')
-rw-r--r--console.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/console.c b/console.c
index 786d63c..090e11c 100644
--- a/console.c
+++ b/console.c
@@ -70,3 +70,18 @@ int getTerminalSize(unsigned short *width, unsigned short *height) {
return 0;
}
+
+int setTerminalSize(int fd, unsigned short width, unsigned short height) {
+ struct winsize ws;
+
+ ws.ws_col = width;
+ ws.ws_row = height;
+
+ if (ioctl(fd, TIOCSWINSZ, &ws) != 0) {
+ perror("TIOCSWINSZ");
+ return -1;
+ }
+
+ return 0;
+}
+