pinentry-0.7.2-curses-utf-8.diff 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --- m4/curses.m4
  2. +++ m4/curses.m4
  3. @@ -28,7 +28,7 @@
  4. AC_ARG_ENABLE(ncurses, [ --disable-ncurses don't prefer -lncurses over -lcurses],
  5. , enable_ncurses=yes)
  6. if test "$enable_ncurses" = yes; then
  7. - AC_CHECK_LIB(ncurses, initscr, LIBNCURSES="-lncurses")
  8. + AC_CHECK_LIB(ncursesw, initscr, LIBNCURSES="-lncursesw")
  9. if test "$LIBNCURSES"; then
  10. # Use ncurses header files instead of the ordinary ones, if possible;
  11. # is there a better way of doing this, that avoids looking in specific
  12. --- pinentry/pinentry-curses.c
  13. +++ pinentry/pinentry-curses.c
  14. @@ -546,6 +545,14 @@
  15. SCREEN *screen = 0;
  16. int done = 0;
  17. char *pin_utf8;
  18. + char *old_ctype = NULL;
  19. +
  20. +
  21. + if (pinentry->lc_ctype)
  22. + {
  23. + old_ctype = strdup (setlocale (LC_CTYPE, NULL));
  24. + setlocale (LC_CTYPE, pinentry->lc_ctype);
  25. + }
  26. /* Open the desired terminal if necessary. */
  27. if (tty_name)
  28. @@ -684,6 +690,12 @@
  29. if (screen)
  30. delscreen (screen);
  31. + if (old_ctype)
  32. + {
  33. + setlocale (LC_CTYPE, old_ctype);
  34. + free(old_ctype);
  35. + }
  36. +
  37. if (ttyfi)
  38. fclose (ttyfi);
  39. if (ttyfo)