Mercurial > dropbear
diff cli-chansession.c @ 41:18eccbfb9641
added window-size change handling
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 01 Aug 2004 09:41:37 +0000 |
parents | b4874d772210 |
children | 3a4f0ef1e8c3 |
line wrap: on
line diff
--- a/cli-chansession.c Sun Aug 01 08:54:01 2004 +0000 +++ b/cli-chansession.c Sun Aug 01 09:41:37 2004 +0000 @@ -203,6 +203,32 @@ } +static void sigwinch_handler(int dummy) { + + cli_ses.winchange = 1; + +} + +void cli_chansess_winchange() { + + unsigned int i; + struct Channel *channel = NULL; + + for (i = 0; i < ses.chansize; i++) { + channel = ses.channels[i]; + if (channel != NULL && channel->type == &clichansess) { + CHECKCLEARTOWRITE(); + buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST); + buf_putint(ses.writepayload, channel->remotechan); + buf_putstring(ses.writepayload, "window-change", 13); + buf_putbyte(ses.writepayload, 0); /* FALSE says the spec */ + put_winsize(); + encrypt_packet(); + } + } + cli_ses.winchange = 0; +} + static void send_chansess_pty_req(struct Channel *channel) { unsigned char* term = NULL; @@ -228,6 +254,11 @@ put_termcodes(); encrypt_packet(); + + /* Set up a window-change handler */ + if (signal(SIGWINCH, sigwinch_handler) == SIG_ERR) { + dropbear_exit("signal error"); + } TRACE(("leave send_chansess_pty_req")); } @@ -275,7 +306,6 @@ } - void cli_send_chansess_request() { TRACE(("enter cli_send_chansess_request"));