MacOS updates. Initial support for GUSI (MacOS socket implementation)
[openssl.git] / crypto / des / read_pwd.c
index 8ac1f1e36e0222674a5a8c104ddfb2a8e45902d7..fa2d67da643f11de4a55dbd2d94306d89b3025a6 100644 (file)
  */
 
 #if !defined(MSDOS) && !defined(VMS) && !defined(WIN32)
-#include <unistd.h>
+#include <openssl/opensslconf.h>
+#ifdef OPENSSL_UNISTD
+# include OPENSSL_UNISTD
+#else
+# include <unistd.h>
+#endif
 /* If unistd.h defines _POSIX_VERSION, we conclude that we
  * are on a POSIX system and have sigaction and termios. */
 #if defined(_POSIX_VERSION)
 #undef  SGTTY
 #endif
 
-#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS)
+#if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE)
 #undef  TERMIOS
 #undef  TERMIO
 #define SGTTY
 #define TTY_set(tty,data)      ioctl(tty,TIOCSETP,data)
 #endif
 
-#if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS)
+#if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS) && !defined(MAC_OS_pre_X)
 #include <sys/ioctl.h>
 #endif
 
@@ -173,6 +178,15 @@ struct IOSB {
        };
 #endif
 
+#if defined(MAC_OS_pre_X) || defined(MAC_OS_GUSI_SOURCE)
+/*
+ * This one needs work. As a matter of fact the code is unoperational
+ * and this is only a trick to get it compiled.
+ *                                     <appro@fy.chalmers.se>
+ */
+#define TTY_STRUCT int
+#endif
+
 #ifndef NX509_SIG
 #define NX509_SIG 32
 #endif
@@ -187,11 +201,7 @@ static int noecho_fgets(char *buf, int size, FILE *tty);
 #ifdef SIGACTION
  static struct sigaction savsig[NX509_SIG];
 #else
-# ifndef NOPROTO
   static void (*savsig[NX509_SIG])(int );
-# else
-  static void (*savsig[NX509_SIG])();
-# endif
 #endif
 static jmp_buf save;
 
@@ -476,11 +486,11 @@ static int noecho_fgets(char *buf, int size, FILE *tty)
  * usually a CR so this can be trouble. No STDIO fix seems to work but
  * flushing the console appears to do the trick.
  */
-                {
-                        HANDLE inh;
-                        inh = GetStdHandle(STD_INPUT_HANDLE);
-                        FlushConsoleInputBuffer(inh);
-                }
+               {
+                       HANDLE inh;
+                       inh = GetStdHandle(STD_INPUT_HANDLE);
+                       FlushConsoleInputBuffer(inh);
+               }
 #endif
        return(strlen(buf));
        }