From a896d400a0bd65512e7c779306aae7480ee079b4 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 13 Sep 2015 09:19:26 -0500 Subject: move windows file IO mode setup to apps_win.c --- apps/openssl/compat/apps_win.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'apps') diff --git a/apps/openssl/compat/apps_win.c b/apps/openssl/compat/apps_win.c index 496ac03..37bfcc9 100644 --- a/apps/openssl/compat/apps_win.c +++ b/apps/openssl/compat/apps_win.c @@ -7,6 +7,9 @@ #include +#include +#include + #include "apps.h" double @@ -27,3 +30,31 @@ app_tminterval(int stop, int usertime) } return 0; } + +int +setup_ui(void) +{ + ui_method = UI_create_method("OpenSSL application user interface"); + UI_method_set_opener(ui_method, ui_open); + UI_method_set_reader(ui_method, ui_read); + UI_method_set_writer(ui_method, ui_write); + UI_method_set_closer(ui_method, ui_close); + + /* + * Set STDIO to binary + */ + _setmode(_fileno(stdin), _O_BINARY); + _setmode(_fileno(stdout), _O_BINARY); + _setmode(_fileno(stderr), _O_BINARY); + + return 0; +} + +void +destroy_ui(void) +{ + if (ui_method) { + UI_destroy_method(ui_method); + ui_method = NULL; + } +} -- cgit v1.2.3-55-g6feb