comparison Resources/Patches/openssl-lsb.diff @ 566:6a3e2ca7a7a0 laaw

the client library compiles with LSB 4.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 24 Sep 2013 15:12:51 +0200
parents
children
comparison
equal deleted inserted replaced
564:06119badb2b0 566:6a3e2ca7a7a0
1 --- ui_openssl.c.orig 2013-09-24 15:06:54.264420779 +0200
2 +++ ui_openssl.c 2013-09-24 14:22:43.512312998 +0200
3 @@ -291,7 +291,7 @@
4 static unsigned short channel = 0;
5 #else
6 #if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__)
7 -static TTY_STRUCT tty_orig,tty_new;
8 +//static TTY_STRUCT tty_orig,tty_new;
9 #endif
10 #endif
11 static FILE *tty_in, *tty_out;
12 @@ -475,106 +475,21 @@
13 /* Internal functions to open, handle and close a channel to the console. */
14 static int open_console(UI *ui)
15 {
16 - CRYPTO_w_lock(CRYPTO_LOCK_UI);
17 - is_a_tty = 1;
18 -
19 -#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS)
20 - tty_in=stdin;
21 - tty_out=stderr;
22 -#else
23 -# ifdef OPENSSL_SYS_MSDOS
24 -# define DEV_TTY "con"
25 -# else
26 -# define DEV_TTY "/dev/tty"
27 -# endif
28 - if ((tty_in=fopen(DEV_TTY,"r")) == NULL)
29 - tty_in=stdin;
30 - if ((tty_out=fopen(DEV_TTY,"w")) == NULL)
31 - tty_out=stderr;
32 -#endif
33 -
34 -#if defined(TTY_get) && !defined(OPENSSL_SYS_VMS)
35 - if (TTY_get(fileno(tty_in),&tty_orig) == -1)
36 - {
37 -#ifdef ENOTTY
38 - if (errno == ENOTTY)
39 - is_a_tty=0;
40 - else
41 -#endif
42 -#ifdef EINVAL
43 - /* Ariel Glenn ariel@columbia.edu reports that solaris
44 - * can return EINVAL instead. This should be ok */
45 - if (errno == EINVAL)
46 - is_a_tty=0;
47 - else
48 -#endif
49 - return 0;
50 - }
51 -#endif
52 -#ifdef OPENSSL_SYS_VMS
53 - status = sys$assign(&terminal,&channel,0,0);
54 - if (status != SS$_NORMAL)
55 - return 0;
56 - status=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0);
57 - if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
58 - return 0;
59 -#endif
60 return 1;
61 }
62
63 static int noecho_console(UI *ui)
64 {
65 -#ifdef TTY_FLAGS
66 - memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
67 - tty_new.TTY_FLAGS &= ~ECHO;
68 -#endif
69 -
70 -#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
71 - if (is_a_tty && (TTY_set(fileno(tty_in),&tty_new) == -1))
72 - return 0;
73 -#endif
74 -#ifdef OPENSSL_SYS_VMS
75 - tty_new[0] = tty_orig[0];
76 - tty_new[1] = tty_orig[1] | TT$M_NOECHO;
77 - tty_new[2] = tty_orig[2];
78 - status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
79 - if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
80 - return 0;
81 -#endif
82 return 1;
83 }
84
85 static int echo_console(UI *ui)
86 {
87 -#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
88 - memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig));
89 - tty_new.TTY_FLAGS |= ECHO;
90 -#endif
91 -
92 -#if defined(TTY_set) && !defined(OPENSSL_SYS_VMS)
93 - if (is_a_tty && (TTY_set(fileno(tty_in),&tty_new) == -1))
94 - return 0;
95 -#endif
96 -#ifdef OPENSSL_SYS_VMS
97 - tty_new[0] = tty_orig[0];
98 - tty_new[1] = tty_orig[1] & ~TT$M_NOECHO;
99 - tty_new[2] = tty_orig[2];
100 - status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0);
101 - if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL))
102 - return 0;
103 -#endif
104 return 1;
105 }
106
107 static int close_console(UI *ui)
108 {
109 - if (tty_in != stdin) fclose(tty_in);
110 - if (tty_out != stderr) fclose(tty_out);
111 -#ifdef OPENSSL_SYS_VMS
112 - status = sys$dassgn(channel);
113 -#endif
114 - CRYPTO_w_unlock(CRYPTO_LOCK_UI);
115 -
116 return 1;
117 }
118