summaryrefslogtreecommitdiffstats
path: root/job.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-03-26 11:11:37 +0000
committerThomas Adam <thomas@xteddy.org>2020-03-26 11:11:37 +0000
commit8a57d14f4bf9edacaa5a7f720d589e650b8f22be (patch)
treecf8e38d3da3cc84a628f2f985de2eea7cb6bf2f1 /job.c
parentf652d777a61c1591805a6251160e35674699ced8 (diff)
parent55b14cdc6aa23870843dd31239e56e8816bf90ff (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'job.c')
-rw-r--r--job.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/job.c b/job.c
index 37580095..607f7138 100644
--- a/job.c
+++ b/job.c
@@ -17,6 +17,7 @@
*/
#include <sys/types.h>
+#include <sys/ioctl.h>
#include <sys/socket.h>
#include <fcntl.h>
@@ -203,6 +204,24 @@ job_free(struct job *job)
free(job);
}
+/* Resize job. */
+void
+job_resize(struct job *job, u_int sx, u_int sy)
+{
+ struct winsize ws;
+
+ if (job->fd == -1 || (~job->flags & JOB_PTY))
+ return;
+
+ log_debug("resize job %p: %ux%u", job, sx, sy);
+
+ memset(&ws, 0, sizeof ws);
+ ws.ws_col = sx;
+ ws.ws_row = sy;
+ if (ioctl(job->fd, TIOCSWINSZ, &ws) == -1)
+ fatal("ioctl failed");
+}
+
/* Job buffer read callback. */
static void
job_read_callback(__unused struct bufferevent *bufev, void *data)