diff nnchat.c @ 110:8af4072dc31a

Fix Win32/MinGW/PDcurses issues.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Oct 2010 18:28:22 +0300
parents 1323a7f88c21
children 9db08807018f
line wrap: on
line diff
--- a/nnchat.c	Sat Oct 23 02:55:45 2010 +0300
+++ b/nnchat.c	Sun Oct 24 18:28:22 2010 +0300
@@ -175,8 +175,15 @@
     if ((tmpTime = localtime(&timeStamp)) != NULL) {
         strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime);
     }
-    
+
+#ifdef __WIN32
+    /* PDCurses does not like the hack used for ncurses to get a specific
+     * colour background .. so we just use something else, but uglier. :|
+     */
+    wbkgdset(statusWin, A_REVERSE | COLOR_PAIR(13));
+#else
     wbkgdset(statusWin, 0x0d00);
+#endif
     werase(statusWin);
     
     wattrset(statusWin, A_BOLD);
@@ -246,7 +253,7 @@
                 waddch(win, ((unsigned char) *s) | col);
                 s++;
             } else {
-                while (*s && isdigit((int) *s)) {
+                while (*s >= '0' && *s <= '9') {
                     val *= 10;
                     val += (*s - '0');
                     s++;
@@ -261,6 +268,10 @@
                 }
             }
         } else {
+#ifdef __WIN32
+            /* A little hack for win32 + PDCurses */
+            if (*s != '\r')
+#endif
             waddch(win, ((unsigned char) *s) | col);
             s++;
         }
@@ -798,6 +809,7 @@
         meta(stdscr, TRUE);
         timeout(SET_DELAY);
         curVis = curs_set(0);
+
         if (has_colors()) {
             start_color();
             
@@ -817,7 +829,6 @@
             init_pair(14, COLOR_BLUE,    COLOR_RED);
             init_pair(15, COLOR_MAGENTA, COLOR_RED);
             init_pair(16, COLOR_CYAN,    COLOR_RED);
-            
         }
         
         cursesInit = TRUE;