first round of unifdef hammering
authortedu <tedu@openbsd.org>
Wed, 16 Apr 2014 02:50:09 +0000 (02:50 +0000)
committertedu <tedu@openbsd.org>
Wed, 16 Apr 2014 02:50:09 +0000 (02:50 +0000)
lib/libssl/src/apps/app_rand.c
lib/libssl/src/apps/apps.c
lib/libssl/src/apps/s_client.c
lib/libssl/src/apps/s_server.c
lib/libssl/src/apps/s_socket.c
lib/libssl/src/apps/s_time.c
lib/libssl/src/apps/speed.c

index b7b6128..66e47c4 100644 (file)
@@ -124,12 +124,6 @@ int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
        int consider_randfile = (file == NULL);
        char buffer[200];
        
-#ifdef OPENSSL_SYS_WINDOWS
-       BIO_printf(bio_e,"Loading 'screen' into random state -");
-       BIO_flush(bio_e);
-       RAND_screen();
-       BIO_printf(bio_e," done\n");
-#endif
 
        if (file == NULL)
                file = RAND_file_name(buffer, sizeof buffer);
index 5162c01..4d5e3f1 100644 (file)
@@ -300,21 +300,12 @@ void program_name(char *in, char *out, int size)
                p=in;
        n=strlen(p);
 
-#if defined(OPENSSL_SYS_NETWARE)
-   /* strip off trailing .nlm if present. */
-   if ((n > 4) && (p[n-4] == '.') &&
-      ((p[n-3] == 'n') || (p[n-3] == 'N')) &&
-      ((p[n-2] == 'l') || (p[n-2] == 'L')) &&
-      ((p[n-1] == 'm') || (p[n-1] == 'M')))
-      n-=4;
-#else
        /* strip off trailing .exe if present. */
        if ((n > 4) && (p[n-4] == '.') &&
                ((p[n-3] == 'e') || (p[n-3] == 'E')) &&
                ((p[n-2] == 'x') || (p[n-2] == 'X')) &&
                ((p[n-1] == 'e') || (p[n-1] == 'E')))
                n-=4;
-#endif
 
        if (n > size-1)
                n=size-1;
@@ -2791,28 +2782,6 @@ double app_tminterval(int stop,int usertime)
        return (ret);
        }
 
-#elif defined(OPENSSL_SYS_NETWARE)
-#include <time.h>
-
-double app_tminterval(int stop,int usertime)
-       {
-       double          ret=0;
-       static clock_t  tmstart;
-       static int      warning=1;
-
-       if (usertime && warning)
-               {
-               BIO_printf(bio_err,"To get meaningful results, run "
-                                  "this program on idle system.\n");
-               warning=0;
-               }
-
-       if (stop==TM_START)     tmstart = clock();
-       else                    ret     = (clock()-tmstart)/(double)CLOCKS_PER_SEC;
-
-       return (ret);
-       }
-
 #elif defined(OPENSSL_SYSTEM_VXWORKS)
 #include <time.h>
 
index cb0a768..6ca36de 100644 (file)
 #include "s_apps.h"
 #include "timeouts.h"
 
-#if defined(OPENSSL_SYS_BEOS_R5)
-#include <fcntl.h>
-#endif
 
 #undef PROG
 #define PROG   s_client_main
@@ -595,9 +592,6 @@ int MAIN(int argc, char **argv)
        ENGINE *e=NULL;
 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
        struct timeval tv;
-#if defined(OPENSSL_SYS_BEOS_R5)
-       int stdin_set = 0;
-#endif
 #endif
 #ifndef OPENSSL_NO_TLSEXT
        char *servername = NULL; 
@@ -1610,35 +1604,6 @@ SSL_set_tlsext_status_ids(con, ids);
                                } else  i=select(width,(void *)&readfds,(void *)&writefds,
                                         NULL,timeoutp);
                        }
-#elif defined(OPENSSL_SYS_NETWARE)
-                       if(!write_tty) {
-                               if(read_tty) {
-                                       tv.tv_sec = 1;
-                                       tv.tv_usec = 0;
-                                       i=select(width,(void *)&readfds,(void *)&writefds,
-                                               NULL,&tv);
-                               } else  i=select(width,(void *)&readfds,(void *)&writefds,
-                                       NULL,timeoutp);
-                       }
-#elif defined(OPENSSL_SYS_BEOS_R5)
-                       /* Under BeOS-R5 the situation is similar to DOS */
-                       i=0;
-                       stdin_set = 0;
-                       (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
-                       if(!write_tty) {
-                               if(read_tty) {
-                                       tv.tv_sec = 1;
-                                       tv.tv_usec = 0;
-                                       i=select(width,(void *)&readfds,(void *)&writefds,
-                                                NULL,&tv);
-                                       if (read(fileno(stdin), sbuf, 0) >= 0)
-                                               stdin_set = 1;
-                                       if (!i && (stdin_set != 1 || !read_tty))
-                                               continue;
-                               } else  i=select(width,(void *)&readfds,(void *)&writefds,
-                                        NULL,timeoutp);
-                       }
-                       (void)fcntl(fileno(stdin), F_SETFL, 0);
 #else
                        i=select(width,(void *)&readfds,(void *)&writefds,
                                 NULL,timeoutp);
@@ -1812,10 +1777,6 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 #else
                else if ((_kbhit()) || (WAIT_OBJECT_0 == WaitForSingleObject(GetStdHandle(STD_INPUT_HANDLE), 0)))
 #endif
-#elif defined (OPENSSL_SYS_NETWARE)
-               else if (_kbhit())
-#elif defined(OPENSSL_SYS_BEOS_R5)
-               else if (stdin_set)
 #else
                else if (FD_ISSET(fileno(stdin),&readfds))
 #endif
index 4ad535b..8d75680 100644 (file)
 #define APPS_WIN16
 #endif
 
-#if !defined(OPENSSL_SYS_NETWARE)  /* conflicts with winsock2 stuff on netware */
 #include <sys/types.h>
-#endif
 
 #include <openssl/lhash.h>
 #include <openssl/bn.h>
 #include "s_apps.h"
 #include "timeouts.h"
 
-#if defined(OPENSSL_SYS_BEOS_R5)
-#include <fcntl.h>
-#endif
 
 #ifndef OPENSSL_NO_RSA
 static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength);
@@ -1947,17 +1942,6 @@ static int sv_body(char *hostname, int s, unsigned char *context)
                        if((i < 0) || (!i && !_kbhit() ) )continue;
                        if(_kbhit())
                                read_from_terminal = 1;
-#elif defined(OPENSSL_SYS_BEOS_R5)
-                       /* Under BeOS-R5 the situation is similar to DOS */
-                       tv.tv_sec = 1;
-                       tv.tv_usec = 0;
-                       (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
-                       i=select(width,(void *)&readfds,NULL,NULL,&tv);
-                       if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
-                               continue;
-                       if (read(fileno(stdin), buf, 0) >= 0)
-                               read_from_terminal = 1;
-                       (void)fcntl(fileno(stdin), F_SETFL, 0);
 #else
                        if ((SSL_version(con) == DTLS1_VERSION) &&
                                DTLSv1_get_timeout(con, &timeout))
@@ -2496,9 +2480,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
                        else
                                {
                                BIO_printf(bio_s_out,"read R BLOCK\n");
-#if defined(OPENSSL_SYS_NETWARE)
-            delay(1000);
-#elif !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
+#if   !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
                                sleep(1);
 #endif
                                continue;
index a301567..73dcdfd 100644 (file)
@@ -97,65 +97,14 @@ static int init_server(int *sock, int port, int type);
 static int init_server_long(int *sock, int port,char *ip, int type);
 static int do_accept(int acc_sock, int *sock, char **host);
 
-#ifdef OPENSSL_SYS_WIN16
-#define SOCKET_PROTOCOL        0 /* more microsoft stupidity */
-#else
 #define SOCKET_PROTOCOL        IPPROTO_TCP
-#endif
 
 #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
 static int wsa_init_done=0;
 #endif
 
-#ifdef OPENSSL_SYS_WINDOWS
-static struct WSAData wsa_state;
-static int wsa_init_done=0;
 
-#ifdef OPENSSL_SYS_WIN16
-static HWND topWnd=0;
-static FARPROC lpTopWndProc=NULL;
-static FARPROC lpTopHookProc=NULL;
-extern HINSTANCE _hInstance;  /* nice global CRT provides */
-
-static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam,
-            LPARAM lParam)
-       {
-       if (hwnd == topWnd)
-               {
-               switch(message)
-                       {
-               case WM_DESTROY:
-               case WM_CLOSE:
-                       SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc);
-                       ssl_sock_cleanup();
-                       break;
-                       }
-               }
-       return CallWindowProc(lpTopWndProc,hwnd,message,wParam,lParam);
-       }
-
-static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
-       {
-       topWnd=hwnd;
-       return(FALSE);
-       }
-
-#endif /* OPENSSL_SYS_WIN32 */
-#endif /* OPENSSL_SYS_WINDOWS */
-
-#ifdef OPENSSL_SYS_WINDOWS
-static void ssl_sock_cleanup(void)
-       {
-       if (wsa_init_done)
-               {
-               wsa_init_done=0;
-#ifndef OPENSSL_SYS_WINCE
-               WSACancelBlockingCall();
-#endif
-               WSACleanup();
-               }
-       }
-#elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
+#if   defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
 static void sock_cleanup(void)
     {
     if (wsa_init_done)
@@ -173,31 +122,6 @@ static int ssl_sock_init(void)
        _watt_do_exit = 0;
        if (sock_init())
                return (0);
-#elif defined(OPENSSL_SYS_WINDOWS)
-       if (!wsa_init_done)
-               {
-               int err;
-         
-#ifdef SIGINT
-               signal(SIGINT,(void (*)(int))ssl_sock_cleanup);
-#endif
-               wsa_init_done=1;
-               memset(&wsa_state,0,sizeof(wsa_state));
-               if (WSAStartup(0x0101,&wsa_state)!=0)
-                       {
-                       err=WSAGetLastError();
-                       BIO_printf(bio_err,"unable to start WINSOCK, error code=%d\n",err);
-                       return(0);
-                       }
-
-#ifdef OPENSSL_SYS_WIN16
-               EnumTaskWindows(GetCurrentTask(),enumproc,0L);
-               lpTopWndProc=(FARPROC)GetWindowLong(topWnd,GWL_WNDPROC);
-               lpTopHookProc=MakeProcInstance((FARPROC)topHookProc,_hInstance);
-
-               SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
-#endif /* OPENSSL_SYS_WIN16 */
-               }
 #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
    WORD wVerReq;
    WSADATA wsaData;
@@ -348,9 +272,7 @@ static int init_server_long(int *sock, int port, char *ip, int type)
 #endif
        if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1)
                {
-#ifndef OPENSSL_SYS_WINDOWS
                perror("bind");
-#endif
                goto err;
                }
        /* Make it 128 for linux */
@@ -381,9 +303,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
 
        if (!ssl_sock_init()) return(0);
 
-#ifndef OPENSSL_SYS_WINDOWS
 redoit:
-#endif
 
        memset((char *)&from,0,sizeof(from));
        len=sizeof(from);
index f9fcf7d..1ec2a97 100644 (file)
@@ -81,9 +81,7 @@
 #include "winmain.h"
 #include "wintext.h"
 #endif
-#if !defined(OPENSSL_SYS_MSDOS)
 #include OPENSSL_UNISTD
-#endif
 
 #undef PROG
 #define PROG s_time_main
@@ -134,9 +132,6 @@ static int perform=0;
 #ifdef FIONBIO
 static int t_nbio=0;
 #endif
-#ifdef OPENSSL_SYS_WIN32
-static int exitNow = 0;                /* Set when it's time to exit main */
-#endif
 
 static void s_time_init(void)
        {
@@ -157,9 +152,6 @@ static void s_time_init(void)
 
 #ifdef FIONBIO
        t_nbio=0;
-#endif
-#ifdef OPENSSL_SYS_WIN32
-       exitNow = 0;            /* Set when it's time to exit main */
 #endif
        }
 
index 1b94d19..7e60c08 100644 (file)
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/objects.h>
-#if !defined(OPENSSL_SYS_MSDOS)
 #include OPENSSL_UNISTD
-#endif
 
-#ifndef OPENSSL_SYS_NETWARE
 #include <signal.h>
-#endif
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 #include <windows.h>