about summary refs log tree commit diff
path: root/Src/Modules/curses.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-10-28 20:28:29 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-10-28 20:28:29 +0000
commit788320264e75e648d77ffc0c334fb66a751d69b7 (patch)
tree298ff4ea102f20c52f04644dc433f81566a99442 /Src/Modules/curses.c
parent0919edb315104469feb4ac13bdd224966bc32de6 (diff)
downloadzsh-788320264e75e648d77ffc0c334fb66a751d69b7.tar.gz
zsh-788320264e75e648d77ffc0c334fb66a751d69b7.tar.xz
zsh-788320264e75e648d77ffc0c334fb66a751d69b7.zip
add zcurses timeout
Diffstat (limited to 'Src/Modules/curses.c')
-rw-r--r--Src/Modules/curses.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 0f9647fb9..063ac9014 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -562,7 +562,7 @@ zccmd_refresh(const char *nam, char **args)
 
 
 static int
-zccmd_move(const char *nam, char **args)
+zccmd_move(const char *nam,  char **args)
 {
     int y, x;
     LinkNode node;
@@ -936,6 +936,33 @@ zccmd_input(const char *nam, char **args)
 
 
 static int
+zccmd_timeout(const char *nam, char **args)
+{
+    LinkNode node;
+    ZCWin w;
+    int to;
+    char *eptr;
+
+    node = zcurses_validate_window(args[0], ZCURSES_USED);
+    if (node == NULL) {
+	zwarnnam(nam, "%s: %s", zcurses_strerror(zc_errno), args[0]);
+	return 1;
+    }
+
+    w = (ZCWin)getdata(node);
+
+    to = (int)zstrtol(args[1], &eptr, 10);
+    if (*eptr) {
+	zwarnnam(nam, "timeout requires an integer: %s", args[1]);
+	return 1;
+    }
+
+    wtimeout(w->win, to);
+    return 0;
+}
+
+
+static int
 zccmd_position(const char *nam, char **args)
 {
     LinkNode node;
@@ -1019,6 +1046,7 @@ bin_zcurses(char *nam, char **args, Options ops, UNUSED(int func))
 	{"attr", zccmd_attr, 2, -1},
 	{"scroll", zccmd_scroll, 2, 2},
 	{"input", zccmd_input, 1, 3},
+	{"timeout", zccmd_timeout, 2, 2},
 	{"touch", zccmd_touch, 1, -1},
 	{NULL, (zccmd_t)0, 0, 0}
     };