From cc9f787f6e6ac59f0e987e09edfe48ff14ef0757 Mon Sep 17 00:00:00 2001
From: toni <matzeton@googlemail.com>
Date: Mon, 14 Apr 2014 22:14:56 +0200
Subject: replaced getch with wgetch

---
 debian/changelog | 10 ++++++++--
 main.c           |  7 ++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 89e5a8f..20127c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
-naskpass (1.0-1) unstable; urgency=low
+naskpass (1.0-1) UNRELEASED; urgency=low
 
-  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>
+  * replaced getch with ncurses wgetch
+
+ -- Toni Uhlig <matzeton@googlemail.com>  Mon, 14 Apr 2014 22:14:10 +0200
+
+naskpass (1.0) unstable; urgency=low
+
+  * Initial release
 
  -- Toni Uhlig <matzeton@googlemail.com>  Sun, 30 Mar 2014 22:59:32 +0200
diff --git a/main.c b/main.c
index 2e61d81..42b723d 100644
--- a/main.c
+++ b/main.c
@@ -83,6 +83,7 @@ static void usage()
 
 int main(int argc, char **argv)
 {
+  WINDOW *win;
   int ret, ch, curx, cury, pidx, iidx, tries = MAXTRIES;
   size_t slen = 0;
   char pass[MAXPASS+1];
@@ -93,7 +94,7 @@ int main(int argc, char **argv)
     exit(-1);
   }
 
-  initscr();
+  win = initscr();
   start_color();
   init_pair(1, COLOR_RED, COLOR_BLACK);
   raw();
@@ -107,7 +108,7 @@ again:
   pidx = 0;
   iidx = 0;
   print_rel_to_wnd(DEFWIN, 20, 0, "PASSWORD: ");
-  while ( (ch = getch()) != '\n') {
+  while ( (ch = wgetch(win)) != '\n') {
     getyx(DEFWIN, cury, curx);
     clear_pw_status(DEFWIN, slen);
     if (ch == KEY_BACKSPACE) {
@@ -156,7 +157,7 @@ again:
       clear_pw_status(DEFWIN, slen);
       slen = print_pw_status(DEFWIN, "ACCESS DENIED");
       tries--;
-      getch();
+      wgetch(win);
       if (tries == 0) {
         set_logmsg("ACCESS DENIED: HDD is encrypted, can not boot");
         endwin_and_print_debug();
-- 
cgit v1.2.3