aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-01-26 12:55:16 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-01-26 12:55:16 +0000
commitea2d3073ac177d95fc14c310178aa2b7455b060a (patch)
tree28f36380bd0e1a6c21c2fe8e4d56f388e87dc3e4 /termkey.c
parent63f37cecd6c68914016451eae714a163cf988db3 (diff)
downloadtermo-ea2d3073ac177d95fc14c310178aa2b7455b060a.tar.gz
termo-ea2d3073ac177d95fc14c310178aa2b7455b060a.tar.xz
termo-ea2d3073ac177d95fc14c310178aa2b7455b060a.zip
Created termkey_new_abstract()
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/termkey.c b/termkey.c
index 0ef077e..6df53bd 100644
--- a/termkey.c
+++ b/termkey.c
@@ -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;