termux-packages/packages/emacs/no_getpass.patch

36 lines
825 B
Diff
Raw Normal View History

2015-06-13 01:03:31 +02:00
diff -u -r ../emacs-24.3/lib-src/pop.c ./lib-src/pop.c
--- ../emacs-24.3/lib-src/pop.c 2013-01-01 21:37:17.000000000 +0100
+++ ./lib-src/pop.c 2014-02-19 02:54:30.000000000 +0100
@@ -63,6 +63,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <stdbool.h>
#ifdef KERBEROS
# ifdef HAVE_KRB5_H
@@ -126,6 +127,23 @@
char pop_error[ERROR_MAX];
int pop_debug = 0;
+#ifdef __ANDROID__
+static char* getpass(const char* prompt) {
+ printf("%s\n", prompt);
+ static char chars[128];
+ int len = 0;
+ while (true) {
+ char c = fgetc(stdin);
+ if (c == '\r' || c == '\n' || c == 0) break;
+ chars[len++] = c;
+ if (len == sizeof(chars)-1) break;
+ }
+ chars[len] = 0;
+ return chars;
+}
+#endif
+
+
/*
* Function: pop_open (char *host, char *username, char *password,
* int flags)