2017-09-14 19:42:44 +02:00
|
|
|
diff -uNr unrar.mod/consio.cpp unrar.mod2/consio.cpp
|
|
|
|
--- unrar.mod/consio.cpp 2017-08-11 16:56:22.000000000 +0300
|
|
|
|
+++ unrar.mod2/consio.cpp 2017-09-14 20:34:17.247733000 +0300
|
|
|
|
@@ -1,6 +1,10 @@
|
|
|
|
#include "rar.hpp"
|
|
|
|
#include "log.cpp"
|
|
|
|
|
|
|
|
+// For getpass()
|
|
|
|
+#include <termios.h>
|
|
|
|
+#include <readline/readline.h>
|
|
|
|
+
|
|
|
|
static MESSAGE_TYPE MsgStream=MSG_STDOUT;
|
|
|
|
static RAR_CHARSET RedirectCharset=RCH_DEFAULT;
|
|
|
|
|
|
|
|
@@ -57,6 +61,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SILENT
|
|
|
|
+#ifdef __ANDROID__
|
2017-09-14 19:46:28 +02:00
|
|
|
+static char* getpass(const char *prompt) {
|
2017-09-14 19:42:44 +02:00
|
|
|
+ struct termios term_old, term_new;
|
|
|
|
+ int nread;
|
|
|
|
+
|
|
|
|
+ /* Turn echoing off and fail if we can't. */
|
|
|
|
+ if (tcgetattr (0, &term_old) != 0) {
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ term_new = term_old;
|
|
|
|
+ term_new.c_lflag &= ~ECHO;
|
|
|
|
+
|
|
|
|
+ if (tcsetattr (0, TCSAFLUSH, &term_new) != 0) {
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* Read the password. */
|
|
|
|
+ char *password = readline(prompt);
|
|
|
|
+
|
|
|
|
+ /* Restore terminal. */
|
|
|
|
+ (void) tcsetattr (0, TCSAFLUSH, &term_old);
|
|
|
|
+
|
|
|
|
+ return password;
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
static void cvt_wprintf(FILE *dest,const wchar *fmt,va_list arglist)
|
|
|
|
{
|
|
|
|
// This buffer is for format string only, not for entire output,
|