OLD | NEW |
1 /* crypto/ui/ui_openssl.c -*- mode:C; c-file-style: "eay" -*- */ | 1 /* crypto/ui/ui_openssl.c -*- mode:C; c-file-style: "eay" -*- */ |
2 /* Written by Richard Levitte (richard@levitte.org) and others | 2 /* Written by Richard Levitte (richard@levitte.org) and others |
3 * for the OpenSSL project 2001. | 3 * for the OpenSSL project 2001. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 2001 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 | 117 |
118 #include <openssl/e_os2.h> | 118 #include <openssl/e_os2.h> |
119 | 119 |
120 /* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc | 120 /* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc |
121 * [maybe others?], because it masks interfaces not discussed in standard, | 121 * [maybe others?], because it masks interfaces not discussed in standard, |
122 * sigaction and fileno included. -pedantic would be more appropriate for | 122 * sigaction and fileno included. -pedantic would be more appropriate for |
123 * the intended purposes, but we can't prevent users from adding -ansi. | 123 * the intended purposes, but we can't prevent users from adding -ansi. |
124 */ | 124 */ |
125 #ifndef _POSIX_C_SOURCE | 125 #ifndef _POSIX_C_SOURCE |
126 #define _POSIX_C_SOURCE 1 | 126 #define _POSIX_C_SOURCE 2 |
127 #endif | 127 #endif |
128 | |
129 #include <signal.h> | 128 #include <signal.h> |
130 #include <stdio.h> | 129 #include <stdio.h> |
131 #include <string.h> | 130 #include <string.h> |
132 #include <errno.h> | 131 #include <errno.h> |
133 | 132 |
134 #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) | 133 #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) |
135 # ifdef OPENSSL_UNISTD | 134 # ifdef OPENSSL_UNISTD |
136 # include OPENSSL_UNISTD | 135 # include OPENSSL_UNISTD |
137 # else | 136 # else |
138 # include <unistd.h> | 137 # include <unistd.h> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 /* There are 5 types of terminal interface supported, | 177 /* There are 5 types of terminal interface supported, |
179 * TERMIO, TERMIOS, VMS, MSDOS and SGTTY | 178 * TERMIO, TERMIOS, VMS, MSDOS and SGTTY |
180 */ | 179 */ |
181 | 180 |
182 #if defined(__sgi) && !defined(TERMIOS) | 181 #if defined(__sgi) && !defined(TERMIOS) |
183 # define TERMIOS | 182 # define TERMIOS |
184 # undef TERMIO | 183 # undef TERMIO |
185 # undef SGTTY | 184 # undef SGTTY |
186 #endif | 185 #endif |
187 | 186 |
188 #if defined(linux) && !defined(TERMIO) | 187 #if defined(linux) && !defined(TERMIO) && !defined(__ANDROID__) |
189 # undef TERMIOS | 188 # undef TERMIOS |
190 # define TERMIO | 189 # define TERMIO |
191 # undef SGTTY | 190 # undef SGTTY |
192 #endif | 191 #endif |
193 | 192 |
194 #ifdef _LIBC | 193 #ifdef _LIBC |
195 # undef TERMIOS | 194 # undef TERMIOS |
196 # define TERMIO | 195 # define TERMIO |
197 # undef SGTTY | 196 # undef SGTTY |
198 #endif | 197 #endif |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 return ok; | 471 return ok; |
473 } | 472 } |
474 | 473 |
475 | 474 |
476 /* Internal functions to open, handle and close a channel to the console. */ | 475 /* Internal functions to open, handle and close a channel to the console. */ |
477 static int open_console(UI *ui) | 476 static int open_console(UI *ui) |
478 { | 477 { |
479 CRYPTO_w_lock(CRYPTO_LOCK_UI); | 478 CRYPTO_w_lock(CRYPTO_LOCK_UI); |
480 is_a_tty = 1; | 479 is_a_tty = 1; |
481 | 480 |
482 #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || de
fined(OPENSSL_SYS_NETWARE) | 481 #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || de
fined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS) |
483 tty_in=stdin; | 482 tty_in=stdin; |
484 tty_out=stderr; | 483 tty_out=stderr; |
485 #else | 484 #else |
486 # ifdef OPENSSL_SYS_MSDOS | 485 # ifdef OPENSSL_SYS_MSDOS |
487 # define DEV_TTY "con" | 486 # define DEV_TTY "con" |
488 # else | 487 # else |
489 # define DEV_TTY "/dev/tty" | 488 # define DEV_TTY "/dev/tty" |
490 # endif | 489 # endif |
491 if ((tty_in=fopen(DEV_TTY,"r")) == NULL) | 490 if ((tty_in=fopen(DEV_TTY,"r")) == NULL) |
492 tty_in=stdin; | 491 tty_in=stdin; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 */ | 703 */ |
705 { | 704 { |
706 HANDLE inh; | 705 HANDLE inh; |
707 inh = GetStdHandle(STD_INPUT_HANDLE); | 706 inh = GetStdHandle(STD_INPUT_HANDLE); |
708 FlushConsoleInputBuffer(inh); | 707 FlushConsoleInputBuffer(inh); |
709 } | 708 } |
710 #endif | 709 #endif |
711 return(strlen(buf)); | 710 return(strlen(buf)); |
712 } | 711 } |
713 #endif | 712 #endif |
OLD | NEW |