=== modified file 'driver-ti.c' --- driver-ti.c 2012-01-20 17:00:09 +0000 +++ driver-ti.c 2012-01-20 16:44:33 +0000 @@ -289,54 +289,27 @@ return NULL; } -static int start_driver(TermKey *tk, void *info) +static void start_driver(TermKey *tk, void *info) { TermKeyTI *ti = info; - char *start_string = ti->start_string; - size_t len; - - if(tk->fd == -1 || !start_string) - return 1; /* The terminfo database will contain keys in application cursor key mode. * We may need to enable that mode */ - - // Can't call putp or tputs because they suck and don't give us fd control - len = strlen(start_string); - while(len) { - size_t written = write(tk->fd, start_string, len); - if(written == -1) - return 0; - start_string += written; - len -= written; + if(tk->fd != -1 && ti->start_string) { + // Can't call putp or tputs because they suck and don't give us fd control + (void)write(tk->fd, ti->start_string, strlen(ti->start_string)); } - return 1; } -static int stop_driver(TermKey *tk, void *info) +static void stop_driver(TermKey *tk, void *info) { TermKeyTI *ti = info; - char *stop_string = ti->stop_string; - size_t len; - - if(tk->fd == -1 || !stop_string) - return 1; - - /* The terminfo database will contain keys in application cursor key mode. - * We may need to enable that mode - */ - - // Can't call putp or tputs because they suck and don't give us fd control - len = strlen(stop_string); - while(len) { - size_t written = write(tk->fd, stop_string, len); - if(written == -1) - return 0; - stop_string += written; - len -= written; + + if(tk->fd != -1 && ti->stop_string) { + // Can't call putp or tputs because they suck and don't give us fd control + (void)write(tk->fd, ti->stop_string, strlen(ti->stop_string)); } - return 1; } static void free_driver(void *info) === modified file 'termkey-internal.h' --- termkey-internal.h 2012-01-20 17:00:09 +0000 +++ termkey-internal.h 2011-08-28 16:50:18 +0000 @@ -11,8 +11,8 @@ const char *name; void *(*new_driver)(TermKey *tk, const char *term); void (*free_driver)(void *info); - int (*start_driver)(TermKey *tk, void *info); - int (*stop_driver)(TermKey *tk, void *info); + void (*start_driver)(TermKey *tk, void *info); + void (*stop_driver)(TermKey *tk, void *info); TermKeyResult (*peekkey)(TermKey *tk, void *info, TermKeyKey *key, int force, size_t *nbytes); }; === modified file 'termkey.c' --- termkey.c 2012-01-20 17:00:09 +0000 +++ termkey.c 2012-01-18 14:03:39 +0000 @@ -318,8 +318,7 @@ struct TermKeyDriverNode *p; for(p = tk->drivers; p; p = p->next) if(p->driver->start_driver) - if(!(*p->driver->start_driver)(tk, p->info)) - goto abort_free_drivers; + (*p->driver->start_driver)(tk, p->info); #ifdef DEBUG fprintf(stderr, "Drivers started; termkey instance %p is ready\n", tk);