Fix ShowPrompt implementation across display drivers.
[gnushogi.git] / gnushogi / cursesdsp.c
index f4c00ec..d6c7cef 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <ctype.h>
 #include <signal.h>
+#include <stdio.h>
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -150,7 +151,46 @@ Curses_ShowMessage(char *s)
 
 
 void
-ShowNodeCnt(long NodeCnt)
+Curses_AlwaysShowMessage(const char *format, ...)
+{
+    static char buffer[60];
+    va_list ap;
+    va_start(ap, format);
+    vsnprintf(buffer, sizeof(buffer), format, ap);
+    Curses_ShowMessage(buffer);
+    va_end(ap);
+}
+
+
+void
+Curses_Printf(const char *format, ...)
+{
+    static char buffer[60];
+    va_list ap;
+    va_start(ap, format);
+    vsnprintf(buffer, sizeof(buffer), format, ap);
+    printw("%s", buffer);
+    va_end(ap);
+}
+
+
+void
+Curses_doRequestInputString(const char* fmt, char* buffer)
+{
+    FLUSH_SCANW(fmt, buffer);
+}
+
+
+int
+Curses_GetString(char* sx)
+{
+    fflush(stdout);
+    return (getstr(sx) == ERR);
+}
+
+
+void
+Curses_ShowNodeCnt(long NodeCnt)
 {
     gotoXY(TAB, 22);
     /* printw(CP[90], NodeCnt, (et > 100) ? NodeCnt / (et / 100) : 0); */
@@ -186,8 +226,9 @@ ShowPlayers(void)
 
 
 void
-ShowPrompt(void)
+Curses_ShowPrompt(void)
 {
+    Curses_ShowSidetoMove();
     gotoXY(TAB, 17);
     printw(CP[121]);     /* Your move is? */
     ClearEoln();