diff options
Diffstat (limited to 'src/ansi.c')
-rw-r--r-- | src/ansi.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.46 2008/03/06 21:33:02 james + * *** empty log message *** + * * Revision 1.45 2008/03/06 17:21:41 james * *** empty log message *** * @@ -288,6 +291,21 @@ ansi_force_attr_normal (ANSI * a) return 0; } +static int ansi_set_title(ANSI *a,char *t) +{ +char buf[1024]; +int i; +char *term=getenv("TERM"); + +if (!term) return 0; +if (strncmp(term,"xterm",5) && strncmp(term,"rxvt",4)) return 0; + +i=sprintf(buf,"\033]0;%s\007",t); + +if (a->terminal->xmit(a->terminal,buf,i)!=i) return 1; +return 0; +} + static int ansi_set_color (ANSI * a, int color) { @@ -981,6 +999,7 @@ ansi_dispatch (ANSI * a, Context * c) } + static int ansi_update (ANSI * a, Context * c) { @@ -1016,6 +1035,7 @@ ansi_new_from_terminal (TTY * t, int utf8) ret->update = ansi_update; ret->reset = ansi_reset; ret->terminal_reset = ansi_terminal_reset; + ret->set_title=ansi_set_title; ret->close = ansi_free; ret->dispatch = ansi_dispatch; |