diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-09-05 13:58:15 +0100 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-09-05 13:58:15 +0100 |
commit | 3fb6f398e95a441d9e6b739073e0ad8a56cd8d7e (patch) | |
tree | ba72bfaefa466e3d66b193f7494b37a4ee2dfdaa /termkey.c | |
parent | 3a4a1b4ef0dc69f2c530554a15f32e534f02a6f4 (diff) | |
download | termo-3fb6f398e95a441d9e6b739073e0ad8a56cd8d7e.tar.gz termo-3fb6f398e95a441d9e6b739073e0ad8a56cd8d7e.tar.xz termo-3fb6f398e95a441d9e6b739073e0ad8a56cd8d7e.zip |
Handle TERMKEY_RES_ERROR in (debugging mode) res2str()
Diffstat (limited to 'termkey.c')
-rw-r--r-- | termkey.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -153,6 +153,8 @@ static void print_key(TermKey *tk, TermKeyKey *key) static const char *res2str(TermKeyResult res) { + static char errorbuffer[256]; + switch(res) { case TERMKEY_RES_KEY: return "TERMKEY_RES_KEY"; @@ -162,6 +164,9 @@ static const char *res2str(TermKeyResult res) return "TERMKEY_RES_AGAIN"; case TERMKEY_RES_NONE: return "TERMKEY_RES_NONE"; + case TERMKEY_RES_ERROR: + snprintf(errorbuffer, sizeof errorbuffer, "TERMKEY_RES_ERROR(errno=%d)\n", errno); + return (const char*)errorbuffer; } return "unknown"; |