diff --git a/src/client/handle.c b/src/client/handle.c index bc6517f8..600cd4ff 100644 --- a/src/client/handle.c +++ b/src/client/handle.c @@ -34,6 +34,8 @@ #if !defined(_WIN32) #include +#else +#include #endif #include "misc.h" @@ -42,7 +44,11 @@ handleintr(int s) { if (interrupt) { /* tacky, but it works */ +#if !defined(_WIN32) if (write(s, "\naborted\n", 1 + 7 + 1) <= 0) +#else + if (send(s, "\naborted\n", 1 + 7 + 1, 0) <= 0) +#endif return 0; interrupt = 0; } diff --git a/src/client/main.c b/src/client/main.c index df5c345b..db6eecd8 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -250,6 +250,11 @@ main(int ac, s_char **av) FD_SET(sock, &readfds); n = select(sock + 1, &readfds, (fd_set *) 0, (fd_set *) 0, (struct timeval *)&tm); + if (interrupt) { + if (!handleintr(sock)) + break; + errno = 0; + } if (n < 0) { if (errno == EINTR) { errno = WSAGetLastError(); @@ -288,6 +293,9 @@ static void intr(int sig) { interrupt++; +#ifdef _WIN32 + signal(SIGINT, intr); +#endif #ifdef hpux signal(SIGINT, intr); #endif diff --git a/src/client/termio.c b/src/client/termio.c index 27d9da3c..be0bc652 100644 --- a/src/client/termio.c +++ b/src/client/termio.c @@ -98,6 +98,7 @@ termio(int fd, int sock, FILE *auxfi) } } FlushConsoleInputBuffer(hStdIn); + if (n == 0) return 1; } else { n = read(fd, p, sizeof(buf) - i); }