diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-01-26 12:55:16 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2012-01-26 12:55:16 +0000 |
commit | ea2d3073ac177d95fc14c310178aa2b7455b060a (patch) | |
tree | 28f36380bd0e1a6c21c2fe8e4d56f388e87dc3e4 /termkey.c | |
parent | 63f37cecd6c68914016451eae714a163cf988db3 (diff) | |
download | termo-ea2d3073ac177d95fc14c310178aa2b7455b060a.tar.gz termo-ea2d3073ac177d95fc14c310178aa2b7455b060a.tar.xz termo-ea2d3073ac177d95fc14c310178aa2b7455b060a.zip |
Created termkey_new_abstract()
Diffstat (limited to 'termkey.c')
-rw-r--r-- | termkey.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -369,6 +369,24 @@ TermKey *termkey_new(int fd, int flags) return tk; } +TermKey *termkey_new_abstract(const char *term, int flags) +{ + TermKey *tk = termkey_alloc(); + if(!tk) + return NULL; + + tk->fd = -1; + + termkey_set_flags(tk, flags); + + if(!termkey_init(tk, term)) { + free(tk); + return NULL; + } + + return tk; +} + void termkey_free(TermKey *tk) { free(tk->buffer); tk->buffer = NULL; |