X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3608528b1152168da3032e8df4023df45b87299f..72b364a8a94e6c1f60c43aaef2f7c187b44f7d56:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index ee446ece..99acc6f4 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -13,6 +13,7 @@ #include #include #include +#include #define PUTTY_DO_GLOBALS /* actually _define_ globals */ #include "putty.h" @@ -73,8 +74,6 @@ static Config cfg; */ char *platform_default_s(const char *name) { - if (!strcmp(name, "X11Display")) - return dupstr(getenv("DISPLAY")); if (!strcmp(name, "TermType")) return dupstr(getenv("TERM")); if (!strcmp(name, "UserName")) @@ -229,9 +228,11 @@ static void usage(void) printf(" -A -a enable / disable agent forwarding\n"); printf(" -t -T enable / disable pty allocation\n"); printf(" -1 -2 force use of particular protocol version\n"); + printf(" -4 -6 force use of IPv4 or IPv6\n"); printf(" -C enable compression\n"); printf(" -i key private key file for authentication\n"); printf(" -s remote command is an SSH subsystem (SSH-2 only)\n"); + printf(" -N don't start a shell/command (SSH-2 only)\n"); exit(1); } @@ -253,6 +254,7 @@ int main(int argc, char **argv) int errors; int use_subsystem = 0; void *ldisc, *logctx; + long now; ssh_get_line = console_get_line; @@ -471,7 +473,7 @@ int main(int argc, char **argv) /* See if host is of the form user@host */ if (cfg.host[0] != '\0') { - char *atsign = strchr(cfg.host, '@'); + char *atsign = strrchr(cfg.host, '@'); /* Make sure we're not overflowing the user field */ if (atsign) { if (atsign - cfg.host < sizeof cfg.username) { @@ -585,6 +587,7 @@ int main(int argc, char **argv) atexit(cleanup_termios); ldisc_update(NULL, 1, 1); sending = FALSE; + now = GETTICKCOUNT(); while (1) { fd_set rset, wset, xset; @@ -645,7 +648,23 @@ int main(int argc, char **argv) } do { - ret = select(maxfd, &rset, &wset, &xset, NULL); + long next, ticks; + struct timeval tv, *ptv; + + if (run_timers(now, &next)) { + ticks = next - GETTICKCOUNT(); + if (ticks < 0) ticks = 0; /* just in case */ + tv.tv_sec = ticks / 1000; + tv.tv_usec = ticks % 1000 * 1000; + ptv = &tv; + } else { + ptv = NULL; + } + ret = select(maxfd, &rset, &wset, &xset, ptv); + if (ret == 0) + now = next; + else + now = GETTICKCOUNT(); } while (ret < 0 && errno == EINTR); if (ret < 0) {