comparison 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
comparison
equal deleted inserted replaced
40:b4874d772210 41:18eccbfb9641
201 buf_putint(ses.writepayload, ws.ws_xpixel); /* Width */ 201 buf_putint(ses.writepayload, ws.ws_xpixel); /* Width */
202 buf_putint(ses.writepayload, ws.ws_ypixel); /* Height */ 202 buf_putint(ses.writepayload, ws.ws_ypixel); /* Height */
203 203
204 } 204 }
205 205
206 static void sigwinch_handler(int dummy) {
207
208 cli_ses.winchange = 1;
209
210 }
211
212 void cli_chansess_winchange() {
213
214 unsigned int i;
215 struct Channel *channel = NULL;
216
217 for (i = 0; i < ses.chansize; i++) {
218 channel = ses.channels[i];
219 if (channel != NULL && channel->type == &clichansess) {
220 CHECKCLEARTOWRITE();
221 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_REQUEST);
222 buf_putint(ses.writepayload, channel->remotechan);
223 buf_putstring(ses.writepayload, "window-change", 13);
224 buf_putbyte(ses.writepayload, 0); /* FALSE says the spec */
225 put_winsize();
226 encrypt_packet();
227 }
228 }
229 cli_ses.winchange = 0;
230 }
231
206 static void send_chansess_pty_req(struct Channel *channel) { 232 static void send_chansess_pty_req(struct Channel *channel) {
207 233
208 unsigned char* term = NULL; 234 unsigned char* term = NULL;
209 235
210 TRACE(("enter send_chansess_pty_req")); 236 TRACE(("enter send_chansess_pty_req"));
226 252
227 /* Terminal mode encoding */ 253 /* Terminal mode encoding */
228 put_termcodes(); 254 put_termcodes();
229 255
230 encrypt_packet(); 256 encrypt_packet();
257
258 /* Set up a window-change handler */
259 if (signal(SIGWINCH, sigwinch_handler) == SIG_ERR) {
260 dropbear_exit("signal error");
261 }
231 TRACE(("leave send_chansess_pty_req")); 262 TRACE(("leave send_chansess_pty_req"));
232 } 263 }
233 264
234 static void send_chansess_shell_req(struct Channel *channel) { 265 static void send_chansess_shell_req(struct Channel *channel) {
235 266
273 304
274 return 0; /* Success */ 305 return 0; /* Success */
275 306
276 } 307 }
277 308
278
279 void cli_send_chansess_request() { 309 void cli_send_chansess_request() {
280 310
281 TRACE(("enter cli_send_chansess_request")); 311 TRACE(("enter cli_send_chansess_request"));
282 if (send_msg_channel_open_init(STDIN_FILENO, &clichansess) 312 if (send_msg_channel_open_init(STDIN_FILENO, &clichansess)
283 == DROPBEAR_FAILURE) { 313 == DROPBEAR_FAILURE) {