X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/54018d95d47e4aff427c4e76f2d952c063ae077b..2ac3322ef9bc032ad942753a56696764aa0b0f74:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index 8d1aac74..c0261578 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -135,6 +135,8 @@ void ldisc_update(void *frontend, int echo, int edit) } else { mode.c_iflag &= ~ICRNL; mode.c_lflag &= ~(ISIG | ICANON); + mode.c_cc[VMIN] = 1; + mode.c_cc[VTIME] = 0; } tcsetattr(0, TCSANOW, &mode); @@ -210,7 +212,8 @@ static void usage(void) printf("Usage: plink [options] [user@]host [command]\n"); printf(" (\"host\" can also be a PuTTY saved session name)\n"); printf("Options:\n"); - printf(" -V print version information\n"); + printf(" -V print version information and exit\n"); + printf(" -pgpfp print PGP key fingerprints and exit\n"); printf(" -v show verbose messages\n"); printf(" -load sessname Load settings from saved session\n"); printf(" -ssh -telnet -rlogin -raw\n"); @@ -316,6 +319,9 @@ int main(int argc, char **argv) use_subsystem = 1; } else if (!strcmp(p, "-V")) { version(); + } else if (!strcmp(p, "-pgpfp")) { + pgp_fingerprints(); + exit(1); } else if (!strcmp(p, "-o")) { if (argc <= 1) { fprintf(stderr, @@ -664,8 +670,27 @@ int main(int argc, char **argv) ret = select(maxfd, &rset, &wset, &xset, ptv); if (ret == 0) now = next; - else - now = GETTICKCOUNT(); + else { + long newnow = GETTICKCOUNT(); + /* + * Check to see whether the system clock has + * changed massively during the select. + */ + if (newnow - now < 0 || newnow - now > next - now) { + /* + * If so, look at the elapsed time in the + * select and use it to compute a new + * tickcount_offset. + */ + long othernow = now + tv.tv_sec * 1000 + tv.tv_usec / 1000; + /* So we'd like GETTICKCOUNT to have returned othernow, + * but instead it return newnow. Hence ... */ + tickcount_offset += othernow - newnow; + now = othernow; + } else { + now = newnow; + } + } } while (ret < 0 && errno == EINTR); if (ret < 0) {