@@ -178,6 +178,13 @@ typedef unsigned int u_int;
178
178
#include <fcntl.h>
179
179
#endif
180
180
181
+ /* Use Windows API with STD_INPUT_HANDLE when checking for input?
182
+ Don't look at OPENSSL_SYS_MSDOS for this, since it is always defined if
183
+ OPENSSL_SYS_WINDOWS is defined */
184
+ #if defined(OPENSSL_SYS_WINDOWS ) && !defined(OPENSSL_SYS_WINCE ) && defined(STD_INPUT_HANDLE )
185
+ #define OPENSSL_USE_STD_INPUT_HANDLE
186
+ #endif
187
+
181
188
#undef PROG
182
189
#define PROG s_client_main
183
190
@@ -1630,10 +1637,10 @@ SSL_set_tlsext_status_ids(con, ids);
1630
1637
tv .tv_usec = 0 ;
1631
1638
i = select (width ,(void * )& readfds ,(void * )& writefds ,
1632
1639
NULL ,& tv );
1633
- #if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
1634
- if (!i && (!_kbhit () || !read_tty ) ) continue ;
1635
- #else
1640
+ #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
1636
1641
if (!i && (!((_kbhit ()) || (WAIT_OBJECT_0 == WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE ), 0 ))) || !read_tty ) ) continue ;
1642
+ #else
1643
+ if (!i && (!_kbhit () || !read_tty ) ) continue ;
1637
1644
#endif
1638
1645
} else i = select (width ,(void * )& readfds ,(void * )& writefds ,
1639
1646
NULL ,timeoutp );
@@ -1838,10 +1845,10 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
1838
1845
}
1839
1846
1840
1847
#if defined(OPENSSL_SYS_WINDOWS ) || defined(OPENSSL_SYS_MSDOS )
1841
- #if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
1842
- else if (_kbhit ())
1843
- #else
1848
+ #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
1844
1849
else if ((_kbhit ()) || (WAIT_OBJECT_0 == WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE ), 0 )))
1850
+ #else
1851
+ else if (_kbhit ())
1845
1852
#endif
1846
1853
#elif defined (OPENSSL_SYS_NETWARE )
1847
1854
else if (_kbhit ())
0 commit comments