comparison nnchat.c @ 74:98004129202a

Portability fixes.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Nov 2008 14:23:21 +0200
parents c56e766acce1
children abbdd101b267
comparison
equal deleted inserted replaced
73:c56e766acce1 74:98004129202a
261 s++; 261 s++;
262 if (*s == '½') { 262 if (*s == '½') {
263 waddch(win, ((unsigned char) *s) | col); 263 waddch(win, ((unsigned char) *s) | col);
264 s++; 264 s++;
265 } else { 265 } else {
266 while (*s && isdigit(*s)) { 266 while (*s && isdigit((int) *s)) {
267 val *= 10; 267 val *= 10;
268 val += (*s - '0'); 268 val += (*s - '0');
269 s++; 269 s++;
270 } 270 }
271 if (*s != '½') return -1; 271 if (*s != '½') return -1;
295 s++; 295 s++;
296 if (*s == '½') { 296 if (*s == '½') {
297 fputc((unsigned char) *s, outFile); 297 fputc((unsigned char) *s, outFile);
298 s++; 298 s++;
299 } else { 299 } else {
300 while (*s && isdigit(*s)) s++; 300 while (*s && isdigit((int) *s)) s++;
301 if (*s != '½') return -1; 301 if (*s != '½') return -1;
302 s++; 302 s++;
303 } 303 }
304 } else { 304 } else {
305 fputc((unsigned char) *s, outFile); 305 fputc((unsigned char) *s, outFile);
813 813
814 /* Handle several buffered keypresses at once */ 814 /* Handle several buffered keypresses at once */
815 do { 815 do {
816 c = wgetch(stdscr); 816 c = wgetch(stdscr);
817 switch (c) { 817 switch (c) {
818 #ifdef KEY_RESIZE
818 case KEY_RESIZE: 819 case KEY_RESIZE:
819 if (!initializeWindows()) { 820 if (!initializeWindows()) {
820 THERR("Error resizing ncurses windows\n"); 821 THERR("Error resizing ncurses windows\n");
821 isError = TRUE; 822 isError = TRUE;
822 } 823 }
823 break; 824 break;
825 #endif
824 826
825 case KEY_ENTER: 827 case KEY_ENTER:
826 case '\n': 828 case '\n':
827 case '\r': 829 case '\r':
828 /* Call the user input handler */ 830 /* Call the user input handler */
883 update = TRUE; 885 update = TRUE;
884 } 886 }
885 break; 887 break;
886 888
887 case 0x204: /* ctrl+left = Skip words left */ 889 case 0x204: /* ctrl+left = Skip words left */
888 while (editBuf->pos > 0 && isspace(editBuf->data[editBuf->pos - 1])) 890 while (editBuf->pos > 0 && isspace((int) editBuf->data[editBuf->pos - 1]))
889 editBuf->pos--; 891 editBuf->pos--;
890 while (editBuf->pos > 0 && !isspace(editBuf->data[editBuf->pos - 1])) 892 while (editBuf->pos > 0 && !isspace((int) editBuf->data[editBuf->pos - 1]))
891 editBuf->pos--; 893 editBuf->pos--;
892 update = TRUE; 894 update = TRUE;
893 break; 895 break;
894 896
895 case 0x206: /* ctrl+right = Skip words right */ 897 case 0x206: /* ctrl+right = Skip words right */
896 while (editBuf->pos < editBuf->len && isspace(editBuf->data[editBuf->pos])) 898 while (editBuf->pos < editBuf->len && isspace((int) editBuf->data[editBuf->pos]))
897 editBuf->pos++; 899 editBuf->pos++;
898 while (editBuf->pos < editBuf->len && !isspace(editBuf->data[editBuf->pos])) 900 while (editBuf->pos < editBuf->len && !isspace((int) editBuf->data[editBuf->pos]))
899 editBuf->pos++; 901 editBuf->pos++;
900 if (editBuf->pos > editBuf->len) 902 if (editBuf->pos > editBuf->len)
901 editBuf->pos = editBuf->len; 903 editBuf->pos = editBuf->len;
902 update = TRUE; 904 update = TRUE;
903 break; 905 break;