gnupg2: Update from 2.2.5 to 2.2.6
[termux-packages] / packages / emacs / no_getpass.patch
CommitLineData
59f0d218
FF
1diff -u -r ../emacs-24.3/lib-src/pop.c ./lib-src/pop.c
2--- ../emacs-24.3/lib-src/pop.c 2013-01-01 21:37:17.000000000 +0100
3+++ ./lib-src/pop.c 2014-02-19 02:54:30.000000000 +0100
4@@ -63,6 +63,7 @@
5 #include <stdio.h>
6 #include <string.h>
7 #include <unistd.h>
8+#include <stdbool.h>
9
10 #ifdef KERBEROS
11 # ifdef HAVE_KRB5_H
12@@ -126,6 +127,23 @@
13 char pop_error[ERROR_MAX];
14 int pop_debug = 0;
15
16+#ifdef __ANDROID__
17+static char* getpass(const char* prompt) {
18+ printf("%s\n", prompt);
19+ static char chars[128];
20+ int len = 0;
21+ while (true) {
22+ char c = fgetc(stdin);
23+ if (c == '\r' || c == '\n' || c == 0) break;
24+ chars[len++] = c;
25+ if (len == sizeof(chars)-1) break;
26+ }
27+ chars[len] = 0;
28+ return chars;
29+}
30+#endif
31+
32+
33 /*
34 * Function: pop_open (char *host, char *username, char *password,
35 * int flags)