Selected changes for MSDOS, contributed by Gisle Vanem <giva@bgnett.no>.

PR: 669
This commit is contained in:
Richard Levitte 2003-09-27 21:56:08 +00:00
parent 11171f3c74
commit 3d7c4a5a6d
3 changed files with 19 additions and 19 deletions

View File

@ -112,6 +112,14 @@
#include <sys/types.h> #include <sys/types.h>
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
#include <conio.h>
#endif
#ifdef OPENSSL_SYS_MSDOS
#define _kbhit kbhit
#endif
#if defined(OPENSSL_SYS_VMS) && !defined(FD_SET) #if defined(OPENSSL_SYS_VMS) && !defined(FD_SET)
/* VAX C does not defined fd_set and friends, but it's actually quite simple */ /* VAX C does not defined fd_set and friends, but it's actually quite simple */
/* These definitions are borrowed from SOCKETSHR. /Richard Levitte */ /* These definitions are borrowed from SOCKETSHR. /Richard Levitte */

View File

@ -136,10 +136,6 @@ typedef unsigned int u_int;
#include <openssl/rand.h> #include <openssl/rand.h>
#include "s_apps.h" #include "s_apps.h"
#ifdef OPENSSL_SYS_WINDOWS
#include <conio.h>
#endif
#ifdef OPENSSL_SYS_WINCE #ifdef OPENSSL_SYS_WINCE
/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */ /* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
#ifdef fileno #ifdef fileno
@ -260,7 +256,7 @@ int MAIN(int argc, char **argv)
char *engine_id=NULL; char *engine_id=NULL;
ENGINE *e=NULL; ENGINE *e=NULL;
#endif #endif
#ifdef OPENSSL_SYS_WINDOWS #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
struct timeval tv; struct timeval tv;
#endif #endif
@ -644,7 +640,7 @@ re_start:
if (!ssl_pending) if (!ssl_pending)
{ {
#ifndef OPENSSL_SYS_WINDOWS #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
if (tty_on) if (tty_on)
{ {
if (read_tty) FD_SET(fileno(stdin),&readfds); if (read_tty) FD_SET(fileno(stdin),&readfds);
@ -671,8 +667,8 @@ re_start:
* will choke the compiler: if you do have a cast then * will choke the compiler: if you do have a cast then
* you can either go for (int *) or (void *). * you can either go for (int *) or (void *).
*/ */
#ifdef OPENSSL_SYS_WINDOWS #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
/* Under Windows we make the assumption that we can /* Under Windows/DOS we make the assumption that we can
* always write to the tty: therefore if we need to * always write to the tty: therefore if we need to
* write to the tty we just fall through. Otherwise * write to the tty we just fall through. Otherwise
* we timeout the select every second and see if there * we timeout the select every second and see if there
@ -686,7 +682,7 @@ re_start:
tv.tv_usec = 0; tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds, i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv); NULL,&tv);
#ifdef OPENSSL_SYS_WINCE #if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
if(!i && (!_kbhit() || !read_tty) ) continue; if(!i && (!_kbhit() || !read_tty) ) continue;
#else #else
if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue; if(!i && (!((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) || !read_tty) ) continue;
@ -855,8 +851,8 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
} }
} }
#ifdef OPENSSL_SYS_WINDOWS #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
#ifdef OPENSSL_SYS_WINCE #if defined(OPENSSL_SYS_WINCE) || defined(OPENSSL_SYS_MSDOS)
else if (_kbhit()) else if (_kbhit())
#else #else
else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0))) else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))

View File

@ -151,10 +151,6 @@ typedef unsigned int u_int;
#include <openssl/rand.h> #include <openssl/rand.h>
#include "s_apps.h" #include "s_apps.h"
#ifdef OPENSSL_SYS_WINDOWS
#include <conio.h>
#endif
#ifdef OPENSSL_SYS_WINCE #ifdef OPENSSL_SYS_WINCE
/* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */ /* Windows CE incorrectly defines fileno as returning void*, so to avoid problems below... */
#ifdef fileno #ifdef fileno
@ -1001,7 +997,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
unsigned long l; unsigned long l;
SSL *con=NULL; SSL *con=NULL;
BIO *sbio; BIO *sbio;
#ifdef OPENSSL_SYS_WINDOWS #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
struct timeval tv; struct timeval tv;
#endif #endif
@ -1075,7 +1071,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
if (!read_from_sslcon) if (!read_from_sslcon)
{ {
FD_ZERO(&readfds); FD_ZERO(&readfds);
#ifndef OPENSSL_SYS_WINDOWS #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
FD_SET(fileno(stdin),&readfds); FD_SET(fileno(stdin),&readfds);
#endif #endif
FD_SET(s,&readfds); FD_SET(s,&readfds);
@ -1085,8 +1081,8 @@ static int sv_body(char *hostname, int s, unsigned char *context)
* the compiler: if you do have a cast then you can either * the compiler: if you do have a cast then you can either
* go for (int *) or (void *). * go for (int *) or (void *).
*/ */
#ifdef OPENSSL_SYS_WINDOWS #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
/* Under Windows we can't select on stdin: only /* Under DOS (non-djgpp) and Windows we can't select on stdin: only
* on sockets. As a workaround we timeout the select every * on sockets. As a workaround we timeout the select every
* second and check for any keypress. In a proper Windows * second and check for any keypress. In a proper Windows
* application we wouldn't do this because it is inefficient. * application we wouldn't do this because it is inefficient.