@@ -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
@@ -1606,10 +1613,10 @@ SSL_set_tlsext_status_ids(con, ids);
1606
1613
tv .tv_usec = 0 ;
1607
1614
i = select (width ,(void * )& readfds ,(void * )& writefds ,
1608
1615
NULL ,& tv );
1609
- #if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
1610
- if (!i && (!_kbhit () || !read_tty ) ) continue ;
1611
- #else
1616
+ #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
1612
1617
if (!i && (!((_kbhit ()) || (WAIT_OBJECT_0 == WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE ), 0 ))) || !read_tty ) ) continue ;
1618
+ #else
1619
+ if (!i && (!_kbhit () || !read_tty ) ) continue ;
1613
1620
#endif
1614
1621
} else i = select (width ,(void * )& readfds ,(void * )& writefds ,
1615
1622
NULL ,timeoutp );
@@ -1814,10 +1821,10 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
1814
1821
}
1815
1822
1816
1823
#if defined(OPENSSL_SYS_WINDOWS ) || defined(OPENSSL_SYS_MSDOS )
1817
- #if defined(OPENSSL_SYS_WINCE ) || defined(OPENSSL_SYS_MSDOS )
1818
- else if (_kbhit ())
1819
- #else
1824
+ #if defined(OPENSSL_USE_STD_INPUT_HANDLE )
1820
1825
else if ((_kbhit ()) || (WAIT_OBJECT_0 == WaitForSingleObject (GetStdHandle (STD_INPUT_HANDLE ), 0 )))
1826
+ #else
1827
+ else if (_kbhit ())
1821
1828
#endif
1822
1829
#elif defined (OPENSSL_SYS_NETWARE )
1823
1830
else if (_kbhit ())
0 commit comments