From d870aedad1907773f8586fe818a89e6b5178b849 Mon Sep 17 00:00:00 2001
From: Andrew Borodin <aborodin@vmail.ru>
Date: Mon, 2 Dec 2013 16:42:01 +0400
Subject: [PATCH] Ticket #3114: fix broken build with NCurses.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
---
 lib/tty/key.c         | 2 +-
 lib/tty/tty-ncurses.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/tty/key.c b/lib/tty/key.c
index 10a263c..95bc13e 100644
--- a/lib/tty/key.c
+++ b/lib/tty/key.c
@@ -1946,6 +1946,7 @@
 tty_get_event (struct Gpm_Event *event, gboolean redo_event, gboolean block)
 {
     int c;
+    static int flag = 0;        /* Return value from select */
 #ifdef HAVE_LIBGPM
     static struct Gpm_Event ev; /* Mouse event */
 #endif
@@ -1978,7 +1979,6 @@
     while (pending_keys == NULL)
     {
         int nfd;
-        static int flag = 0;    /* Return value from select */
         fd_set select_set;
 
         FD_ZERO (&select_set);
diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
index ea4cbbd..e0b191d 100644
--- a/lib/tty/tty-ncurses.c
+++ b/lib/tty/tty-ncurses.c
@@ -49,6 +49,7 @@
 #include "tty-internal.h"       /* mc_tty_normalize_from_utf8() */
 #include "tty.h"
 #include "color-internal.h"
+#include "key.h"
 #include "mouse.h"
 #include "win.h"
 
@@ -530,6 +531,7 @@
     if (mc_global.utf8_display || c > 255)
     {
         int res;
+        unsigned char str[UTF8_CHAR_LEN + 1];
 
         res = g_unichar_to_utf8 (c, (char *) str);
         if (res == 0)
@@ -540,7 +542,6 @@
         }
         else
         {
-            unsigned char str[UTF8_CHAR_LEN + 1];
             const char *s;
 
             str[res] = '\0';
-- 
1.8.5.1

