pterm : [X] pterm terminal wcwidth uxucs uxmisc tree234 misc ldisc ldiscucs
+ logging uxprint settings pty be_none uxstore signal CHARSET
-plink : [U] uxplink uxcons NONSSH UXSSH be_all logging UXMISC
+plink : [U] uxplink uxcons NONSSH UXSSH be_all logging UXMISC signal
PuTTY : [M] terminal wcwidth ldiscucs logging be_all mac macdlg
+ macterm macucs mac_res.rsrc testback NONSSH MACSSH MACMISC CHARSET
#include <stdio.h>
#include <stdlib.h>
+#include <errno.h>
#include <assert.h>
#include <stdarg.h>
+#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
return osize + esize;
}
+int signalpipe[2];
+
+void sigwinch(int signum)
+{
+ write(signalpipe[1], "x", 1);
+}
+
/*
* Short description of parameters.
*/
if (portnumber != -1)
cfg.port = portnumber;
+ /*
+ * Set up the pipe we'll use to tell us about SIGWINCH.
+ */
+ if (pipe(signalpipe) < 0) {
+ perror("pipe");
+ exit(1);
+ }
+ putty_signal(SIGWINCH, sigwinch);
+
sk_init();
/*
FD_ZERO(&xset);
maxfd = 0;
+ FD_SET_MAX(signalpipe[0], maxfd, rset);
+
if (connopen && !sending &&
back->socket(backhandle) != NULL &&
back->sendok(backhandle) &&
FD_SET_MAX(socket, maxfd, xset);
}
- ret = select(maxfd, &rset, &wset, &xset, NULL);
+ do {
+ ret = select(maxfd, &rset, &wset, &xset, NULL);
+ } while (ret < 0 && errno == EINTR);
if (ret < 0) {
perror("select");
select_result(socket, 2);
}
+ if (FD_ISSET(signalpipe[0], &rset)) {
+ char c[1];
+ struct winsize size;
+ read(signalpipe[0], c, 1); /* ignore its value; it'll be `x' */
+ if (ioctl(0, TIOCGWINSZ, (void *)&size) >= 0)
+ back->size(backhandle, size.ws_col, size.ws_row);
+ }
+
if (FD_ISSET(0, &rset)) {
char buf[4096];
int ret;