Created termkey_new_abstract()

This commit is contained in:
Paul LeoNerd Evans
2012-01-26 12:55:16 +00:00
parent 63f37cecd6
commit ea2d3073ac
3 changed files with 23 additions and 1 deletions

View File

@@ -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;