X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinplink.c;h=5849e0d4a1b8e0caa20cd287949b2af92aafdf9c;hb=6f6e9db932589470975ecc23261cd57eb9e710be;hp=58063352745dbaf7a3e98d779c6ce6f79fa5bc14;hpb=947962e0b95e10151c186048a8b5cc2fb425838c;p=PuTTY.git diff --git a/windows/winplink.c b/windows/winplink.c index 58063352..5849e0d4 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -49,6 +49,15 @@ void modalfatalbox(char *p, ...) } cleanup_exit(1); } +void nonfatal(char *p, ...) +{ + va_list ap; + fprintf(stderr, "ERROR: "); + va_start(ap, p); + vfprintf(stderr, p, ap); + va_end(ap); + fputc('\n', stderr); +} void connection_fatal(void *frontend, char *p, ...) { va_list ap; @@ -289,7 +298,7 @@ int main(int argc, char **argv) int errors; int got_host = FALSE; int use_subsystem = 0; - long now, next; + unsigned long now, next, then; sklist = NULL; skcount = sksize = 0; @@ -343,8 +352,10 @@ int main(int argc, char **argv) } else if (!strcmp(p, "-s")) { /* Save status to write to conf later. */ use_subsystem = 1; - } else if (!strcmp(p, "-V")) { + } else if (!strcmp(p, "-V") || !strcmp(p, "--version")) { version(); + } else if (!strcmp(p, "--help")) { + usage(); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); exit(1); @@ -633,9 +644,15 @@ int main(int argc, char **argv) sending = TRUE; } - if (run_timers(now, &next)) { - ticks = next - GETTICKCOUNT(); - if (ticks < 0) ticks = 0; /* just in case */ + if (toplevel_callback_pending()) { + ticks = 0; + } else if (run_timers(now, &next)) { + then = now; + now = GETTICKCOUNT(); + if (now - then > next - then) + ticks = 0; + else + ticks = next - now; } else { ticks = INFINITE; } @@ -719,6 +736,8 @@ int main(int argc, char **argv) } } + run_toplevel_callbacks(); + if (n == WAIT_TIMEOUT) { now = next; } else {