Allow passing fd = -1 to constructor to make an instance not associated with an fd; must use push_bytes to provide it input

This commit is contained in:
Paul LeoNerd Evans
2012-01-18 14:03:39 +00:00
parent 82ad14175c
commit 6d6afe788c
15 changed files with 28 additions and 16 deletions

View File

@@ -296,7 +296,7 @@ static void start_driver(TermKey *tk, void *info)
/* The terminfo database will contain keys in application cursor key mode.
* We may need to enable that mode
*/
if(ti->start_string) {
if(tk->fd != -1 && ti->start_string) {
// Can't call putp or tputs because they suck and don't give us fd control
write(tk->fd, ti->start_string, strlen(ti->start_string));
}
@@ -306,7 +306,7 @@ static void stop_driver(TermKey *tk, void *info)
{
TermKeyTI *ti = info;
if(ti->stop_string) {
if(tk->fd != -1 && ti->stop_string) {
// Can't call putp or tputs because they suck and don't give us fd control
write(tk->fd, ti->stop_string, strlen(ti->stop_string));
}