Portability patch for HP MPE/iX. Submitted by Mark Bixby <mark_bixby@hp.com>
[openssl.git] / crypto / des / read_pwd.c
index fed49652c0d866c19e2dccfdf0a03362a873c238..c27ec336e7b28aee5dff420e619cd6c71c677a9b 100644 (file)
 
 #if !defined(MSDOS) && !defined(VMS) && !defined(WIN32)
 #include <openssl/opensslconf.h>
-#include OPENSSL_UNISTD
+#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
 
-#ifdef MSDOS
+#if defined(MSDOS) && !defined(__CYGWIN32__)
 #include <conio.h>
 #define fgets(a,b,c) noecho_fgets(a,b,c)
 #endif
@@ -174,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
@@ -252,13 +265,17 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt,
        is_a_tty=1;
        tty=NULL;
 
-#ifndef MSDOS
-       if ((tty=fopen("/dev/tty","r")) == NULL)
-               tty=stdin;
-#else /* MSDOS */
+#ifdef MSDOS
        if ((tty=fopen("con","r")) == NULL)
                tty=stdin;
-#endif /* MSDOS */
+#elif defined(MAC_OS_pre_X)
+       tty=stdin;
+#else
+#ifndef MPE
+       if ((tty=fopen("/dev/tty","r")) == NULL)
+#endif
+               tty=stdin;
+#endif
 
 #if defined(TTY_get) && !defined(VMS)
        if (TTY_get(fileno(tty),&tty_orig) == -1)
@@ -297,8 +314,12 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt,
 
 #if defined(TTY_set) && !defined(VMS)
        if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1))
+#ifdef MPE 
+               ; /* MPE lies -- echo really has been disabled */
+#else
                return(-1);
 #endif
+#endif
 #ifdef VMS
        tty_new[0] = tty_orig[0];
        tty_new[1] = tty_orig[1] | TT$M_NOECHO;