chiark / gitweb /
libgpg-error: workaround no stdout atexit with constructor prior to N (#1017)
[termux-packages] / packages / texlive / dvipdfm-x_fix_getpass.patch
1 --- src/texk/dvipdfm-x/pdfencrypt.h~    2016-01-06 11:13:28.000000000 +0100
2 +++ src/texk/dvipdfm-x/pdfencrypt.h     2016-12-31 11:13:43.734942973 +0100
3 @@ -38,4 +38,19 @@
4                                unsigned char **cipher, size_t *cipher_len);
5  extern pdf_obj *pdf_encrypt_obj (void);
6  
7 +
8 +#ifdef __ANDROID__
9 +static char* getpass(const char* prompt) {
10 +       static char chars[128];
11 +       int len = 0;
12 +       while (true) {
13 +               char c = fgetc(stdin); 
14 +               if (c == '\r' || c == '\n' || c == 0) break; 
15 +               chars[len++] = c;
16 +               if (len == sizeof(chars)-1) break;
17 +       } 
18 +       chars[len] = 0;
19 +       return chars;
20 +}
21 +#endif
22  #endif /* _PDFENCRYPT_H_ */