abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 76bbea220b33cc55f62ae137c34b0cd8402896f0
parent 5a88eee2910c13bac1b4aca4b54a6ea6adbe62ff
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 19 Jun 2014 10:30:03 +0200

Pass correct window size to underlying application

Diffstat:
abduco.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/abduco.c b/abduco.c @@ -100,6 +100,7 @@ typedef struct { int pty; int exit_status; struct termios term; + struct winsize winsize; pid_t pid; volatile sig_atomic_t running; const char *name; @@ -269,7 +270,7 @@ static bool create_session(const char *name, char * const argv[]) { sigemptyset(&sa.sa_mask); sa.sa_handler = server_pty_died_handler; sigaction(SIGCHLD, &sa, NULL); - switch (server.pid = forkpty(&server.pty, NULL, has_term ? &server.term : NULL, NULL)) { + switch (server.pid = forkpty(&server.pty, NULL, has_term ? &server.term : NULL, &server.winsize)) { case 0: /* child process */ fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); close(server.socket); @@ -471,6 +472,11 @@ int main(int argc, char *argv[]) { has_term = true; } + if (ioctl(STDIN_FILENO, TIOCGWINSZ, &server.winsize) == -1) { + server.winsize.ws_col = 80; + server.winsize.ws_row = 25; + } + server.read_pty = (action == 'n'); switch (action) {