about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2007-10-14 04:24:45 +0000
committerClint Adams <clint@users.sourceforge.net>2007-10-14 04:24:45 +0000
commit84a0da6af95dd12393f5afcdafba747a9b8879de (patch)
tree35090afe3556191381c1d0b546a7a76a2219fb26 /Src
parentfe219a362b456de4f94c96e746e5b8955e81312d (diff)
downloadzsh-84a0da6af95dd12393f5afcdafba747a9b8879de.tar.gz
zsh-84a0da6af95dd12393f5afcdafba747a9b8879de.tar.xz
zsh-84a0da6af95dd12393f5afcdafba747a9b8879de.zip
23952: work with non-wide curses as well.
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/curses.c18
-rw-r--r--Src/Modules/curses.mdd2
2 files changed, 18 insertions, 2 deletions
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 325c08292..bfcbeca01 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -30,7 +30,9 @@
 #define _XOPEN_SOURCE_EXTENDED 1
 
 #include <ncurses.h>
-#include <wchar.h>
+#ifdef HAVE_SETCCHAR
+# include <wchar.h>
+#endif
 
 #include <stdio.h>
 
@@ -165,8 +167,10 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
     }
 
     if (OPT_ISSET(ops,'c')) {
+#ifdef HAVE_SETCCHAR
 	wchar_t c;
 	cchar_t cc;
+#endif
 
 	targetwin = zcurses_validate_window(args[0], ZCURSES_USED);
 	if (targetwin == -1) {
@@ -174,6 +178,7 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
 	    return 1;
 	}
 
+#ifdef HAVE_SETCCHAR
 	if (mbrtowc(&c, args[1], MB_CUR_MAX, NULL) < 1)
 	    return 1;
 
@@ -182,14 +187,20 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
 
 	if (wadd_wch(zcurses_WIN[targetwin], &cc)!=OK)
 	    return 1;
+#else
+	if (waddch(zcurses_WIN[targetwin], (chtype)args[1][0])!=OK)
+	    return 1;
+#endif
 
 	return 0;
     }
 
     if (OPT_ISSET(ops,'s')) {
+#ifdef HAVE_SETCCHAR
 	wchar_t *ws;
 	cchar_t *wcc;
 	size_t sl;
+#endif
 
 	targetwin = zcurses_validate_window(args[0], ZCURSES_USED);
 	if (targetwin == -1) {
@@ -197,6 +208,7 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
 	    return 1;
 	}
 
+#ifdef HAVE_SETCCHAR
 	sl = strlen(args[1]);
 
 	if (sl == 0) {
@@ -224,6 +236,10 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
 	}
 
 	free(wcc);
+#else
+	if (waddstr(zcurses_WIN[targetwin], args[1])!=OK)
+	    return 1;
+#endif
 	return 0;
     }
 
diff --git a/Src/Modules/curses.mdd b/Src/Modules/curses.mdd
index 4d27d5c4f..c9c31f267 100644
--- a/Src/Modules/curses.mdd
+++ b/Src/Modules/curses.mdd
@@ -1,5 +1,5 @@
 name=zsh/curses
-link='if test "x$ac_cv_func_initscr" = xyes -a "x$ac_cv_header_curses_h" = xyes -a "x$ac_cv_func_setcchar" = xyes; then echo dynamic; else echo no; fi'
+link='if test "x$ac_cv_func_initscr" = xyes -a "x$ac_cv_header_curses_h" = xyes; then echo dynamic; else echo no; fi'
 load=no
 
 autobins="zcurses"