From 63a3f74532632a7e07b71f805eb806b05b3f19e3 Mon Sep 17 00:00:00 2001 From: james <> Date: Thu, 6 Mar 2008 21:33:02 +0000 Subject: *** empty log message *** --- apps/mainloop.c | 13 +++++++++---- apps/sympathy.c | 19 +++++++++++++++---- configure.in | 5 +++++ src/ansi.c | 20 ++++++++++++++++++++ src/ansi.h | 4 ++++ src/raw.c | 4 +++- 6 files changed, 56 insertions(+), 9 deletions(-) diff --git a/apps/mainloop.c b/apps/mainloop.c index e266179..19c5759 100644 --- a/apps/mainloop.c +++ b/apps/mainloop.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.25 2008/03/06 21:33:02 james + * *** empty log message *** + * * Revision 1.24 2008/03/06 16:49:39 james * *** empty log message *** * @@ -548,16 +551,18 @@ mainloop (Context * c, ANSI * ansi, Socket * server_socket, /*any data from the server */ if (client_socket) { + int err=0; + if (socket_post_select (client_socket, &rfds, &wfds)) break; - while (client_socket->msg) + while (client_socket->msg && !err) { - if (msg_from_server (ansi, client_socket->msg, c)) - break; - + err+=msg_from_server (ansi, client_socket->msg, c); socket_consume_msg (client_socket); } + + if (err) break; } diff --git a/apps/sympathy.c b/apps/sympathy.c index 33c47e7..2a9b314 100644 --- a/apps/sympathy.c +++ b/apps/sympathy.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.35 2008/03/06 21:33:02 james + * *** empty log message *** + * * Revision 1.34 2008/03/06 16:49:39 james * *** empty log message *** * @@ -274,8 +277,9 @@ mome (char *fmt, ...) } + Socket * -find_socket (char *fmt, ...) +find_socket (char **retpath,char *fmt, ...) { Socket *ret; char *path, *leaf, *h, **ptr; @@ -315,13 +319,18 @@ find_socket (char *fmt, ...) ret = socket_connect (path); - free (path); if (ret) { + if (retpath) { + *retpath=path; + } else { + free (path); + } free (leaf); return ret; } + free (path); } @@ -786,11 +795,11 @@ main (int argc, char *argv[]) if (safe_atoi (id) > 0) { - client_socket = find_socket ("%s%d", hostname, safe_atoi (id)); + client_socket = find_socket (&oargs['k'],"%s%d", hostname, safe_atoi (id)); } else { - client_socket = find_socket ("%s", id); + client_socket = find_socket (&oargs['k'],"%s", id); } if (!client_socket) @@ -825,6 +834,8 @@ main (int argc, char *argv[]) ansi_new_from_terminal (terminal_open (0, 1), oflags['u'] ? 0 : 1); ansi->reset (ansi, NULL); + if (ansi->set_title) + ansi->set_title(ansi,oargs['k']); } if (oflags['I']) { diff --git a/configure.in b/configure.in index 89f2fae..7d10aac 100644 --- a/configure.in +++ b/configure.in @@ -8,6 +8,9 @@ dnl dnl $Id$ dnl dnl $Log$ +dnl Revision 1.5 2008/03/06 21:33:02 james +dnl *** empty log message *** +dnl dnl Revision 1.4 2008/02/27 15:17:56 james dnl *** empty log message *** dnl @@ -122,6 +125,8 @@ if test "$ac_cv_struct_tm" = "sys/time.h"; then G2_TM_IN_SYS_TIME=1 fi +CFLAGS=-g + AC_SUBST(G2_TM_H) AC_SUBST(G2_HAVE_STDINT_H) diff --git a/src/ansi.c b/src/ansi.c index a983962..a0a69cd 100644 --- a/src/ansi.c +++ b/src/ansi.c @@ -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; diff --git a/src/ansi.h b/src/ansi.h index 6335d26..d795fdc 100644 --- a/src/ansi.h +++ b/src/ansi.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.17 2008/03/06 21:33:02 james + * *** empty log message *** + * * Revision 1.16 2008/03/06 16:49:05 james * *** empty log message *** * @@ -105,6 +108,7 @@ typedef struct ANSI_struct int (*update) (struct ANSI_struct *, struct Context_struct *); int (*one_shot) (struct ANSI_struct *, struct CRT_struct *); int (*reset) (struct ANSI_struct *, struct CRT_struct *); + int (*set_title) (struct ANSI_struct *,char *); void (*terminal_reset) (struct ANSI_struct *); void (*close) (struct ANSI_struct *); } ANSI; diff --git a/src/raw.c b/src/raw.c index a7f01cd..2bfc977 100644 --- a/src/raw.c +++ b/src/raw.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.4 2008/03/06 21:33:02 james + * *** empty log message *** + * * Revision 1.3 2008/03/06 17:21:41 james * *** empty log message *** * @@ -43,7 +46,6 @@ rx_raw_rx (RX * _r, int ch) RX_Raw *r = (RX_Raw *) _r; int ret; uint8_t c = ch; - printf("RX RAW %d\n",ch); set_blocking(r->wfd); ret=(write (r->wfd, &c, 1) == 1) ? 0 : -1; } -- cgit v1.2.3