aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-11-08 17:43:51 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2008-11-08 17:43:51 +0000
commit9969e197ba48b4c4fd3aab1d29067603e20d1e90 (patch)
tree844bd4b62aebbcb27ef8c1ba37e796afbb885120
parent9cd46fcea30691cd5ab73a43498534bf93b8ca39 (diff)
downloadtermo-9969e197ba48b4c4fd3aab1d29067603e20d1e90.tar.gz
termo-9969e197ba48b4c4fd3aab1d29067603e20d1e90.tar.xz
termo-9969e197ba48b4c4fd3aab1d29067603e20d1e90.zip
Pass 'csi' value to static helper functions in driver-csi
-rw-r--r--driver-csi.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/driver-csi.c b/driver-csi.c
index 29da086..1203a00 100644
--- a/driver-csi.c
+++ b/driver-csi.c
@@ -141,10 +141,8 @@ static void free_driver(void *private)
#define CHARAT(i) (tk->buffer[tk->buffstart + (i)])
-static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *key, int force)
+static termkey_result getkey_csi(termkey_t *tk, termkey_csi *csi, size_t introlen, termkey_key *key, int force)
{
- termkey_csi *csi = tk->driver_info;
-
size_t csi_end = introlen;
while(csi_end < tk->buffcount) {
@@ -242,10 +240,8 @@ static termkey_result getkey_csi(termkey_t *tk, size_t introlen, termkey_key *ke
return TERMKEY_RES_KEY;
}
-static termkey_result getkey_ss3(termkey_t *tk, size_t introlen, termkey_key *key, int force)
+static termkey_result getkey_ss3(termkey_t *tk, termkey_csi *csi, size_t introlen, termkey_key *key, int force)
{
- termkey_csi *csi = tk->driver_info;
-
if(tk->buffcount < introlen + 1) {
if(!force)
return TERMKEY_RES_AGAIN;
@@ -295,20 +291,22 @@ static termkey_result getkey(termkey_t *tk, termkey_key *key, int force)
if(tk->buffcount == 0)
return tk->is_closed ? TERMKEY_RES_EOF : TERMKEY_RES_NONE;
+ termkey_csi *csi = tk->driver_info;
+
// Now we're sure at least 1 byte is valid
unsigned char b0 = CHARAT(0);
if(b0 == 0x1b && tk->buffcount > 1 && CHARAT(1) == '[') {
- return getkey_csi(tk, 2, key, force);
+ return getkey_csi(tk, csi, 2, key, force);
}
else if(b0 == 0x1b && tk->buffcount > 1 && CHARAT(1) == 'O') {
- return getkey_ss3(tk, 2, key, force);
+ return getkey_ss3(tk, csi, 2, key, force);
}
else if(b0 == 0x8f) {
- return getkey_ss3(tk, 1, key, force);
+ return getkey_ss3(tk, csi, 1, key, force);
}
else if(b0 == 0x9b) {
- return getkey_csi(tk, 1, key, force);
+ return getkey_csi(tk, csi, 1, key, force);
}
else
return (*tk->method.getkey_simple)(tk, key, force);