aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorjames <>2008-03-07 14:13:40 +0000
committerjames <>2008-03-07 14:13:40 +0000
commit79ba927ea0d883d505f6f7aa5aed6f7fa902d19d (patch)
tree31a56cff47d077fb21700228fa826ace1ba578ae /apps
parent535429244c611970a7f54a12d570bfd861d6a397 (diff)
downloadsympathy-79ba927ea0d883d505f6f7aa5aed6f7fa902d19d.tar.gz
sympathy-79ba927ea0d883d505f6f7aa5aed6f7fa902d19d.tar.bz2
sympathy-79ba927ea0d883d505f6f7aa5aed6f7fa902d19d.zip
*** empty log message ***
Diffstat (limited to 'apps')
-rw-r--r--apps/clients.c9
-rw-r--r--apps/expand.c26
-rw-r--r--apps/sympathy.c22
3 files changed, 50 insertions, 7 deletions
diff --git a/apps/clients.c b/apps/clients.c
index 346439e..b8d1a4e 100644
--- a/apps/clients.c
+++ b/apps/clients.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.21 2008/03/07 14:13:40 james
+ * *** empty log message ***
+ *
* Revision 1.20 2008/03/07 13:56:39 james
* *** empty log message ***
*
@@ -130,6 +133,10 @@ client_execute_message (Client * client, IPC_Msg * m, Context * c)
case IPC_MSG_TYPE_INITIALIZE:
client_initialize (client, c);
break;
+ case IPC_MSG_TYPE_KILLME:
+ client->dead++;
+ break;
+
default:
log_f (c->l, "<Unhandled message type %d>", m->hdr.type);
}
@@ -230,6 +237,8 @@ clients_post_select (Clients * cs, Context * ctx, fd_set * rfds,
if (c->s->msg) {
client_execute_message (c, c->s->msg, ctx);
socket_consume_msg (c->s);
+ if (c->dead)
+ deaded++;
}
}
diff --git a/apps/expand.c b/apps/expand.c
index 2c07ca1..a0ce888 100644
--- a/apps/expand.c
+++ b/apps/expand.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.2 2008/03/07 14:13:40 james
+ * *** empty log message ***
+ *
* Revision 1.1 2008/03/07 13:56:39 james
* *** empty log message ***
*
@@ -108,7 +111,7 @@ hex (const char **in)
}
char *
-expand (const char *in)
+expand (const char *in,int *len)
{
const char *iptr = in;
int l;
@@ -123,42 +126,53 @@ expand (const char *in)
if (!ret) return ret;
+
+ l=0;
+
while (*iptr) {
if (*iptr == '\\') {
- iptr++;
+ iptr++;
switch (*iptr) {
case '\'':
case '\"':
case '\?':
case '\\':
*(optr++) = *(iptr++);
+ l++;
break;
case 'a':
*(optr++) = '\a';
+ l++;
iptr++;
break;
case 'b':
*(optr++) = '\b';
+ l++;
iptr++;
break;
case 'f':
*(optr++) = '\f';
+ l++;
iptr++;
break;
case 'n':
*(optr++) = '\n';
+ l++;
iptr++;
break;
case 'r':
*(optr++) = '\r';
+ l++;
iptr++;
break;
case 't':
*(optr++) = '\t';
+ l++;
iptr++;
break;
case 'v':
*(optr++) = '\v';
+ l++;
iptr++;
break;
case '0':
@@ -170,19 +184,27 @@ expand (const char *in)
case '6':
case '7':
*(optr++) = octal (&iptr);
+ l++;
break;
case 'x':
*(optr++) = hex (&iptr);
+ l++;
break;
default:
*(optr++) = '\\';
+ l++;
*(optr++) = *(iptr++);
+ l++;
}
} else {
*(optr++) = *(iptr++);
+ l++;
}
}
+ if (*len) *len=l;
+
+
*(optr++) = 0;
return ret;
}
diff --git a/apps/sympathy.c b/apps/sympathy.c
index 7c68529..d40caba 100644
--- a/apps/sympathy.c
+++ b/apps/sympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.39 2008/03/07 14:13:40 james
+ * *** empty log message ***
+ *
* Revision 1.38 2008/03/07 13:56:39 james
* *** empty log message ***
*
@@ -145,7 +148,7 @@ static char rcsid[] =
#include "mainloop.h"
extern void usage (void);
-extern char * expand(const char *);
+extern char * expand(const char *,int *);
static char hostname[1024];
char *socket_dirs[] =
@@ -430,9 +433,17 @@ get_hostname (void)
void send_to_server(Socket *c,char *s)
{
-s=expand(s);
-//FIXME
+int n;
+
+s=expand(s,&n);
+
+if (!n) return;
+while (n--) {
+ ipc_msg_send_key (c, *(uint8_t *)s);
+ s++;
+}
+ ipc_msg_send_killme (c);
}
int
@@ -776,6 +787,7 @@ main (int argc, char *argv[])
fatal_moan ("-I requires an arugment");
send_to_server(client_socket,oargs['I']);
} else {
+
if (client_socket)
ipc_msg_send_initialize (client_socket);
@@ -794,13 +806,13 @@ main (int argc, char *argv[])
ansi->set_title (ansi, oargs['k']);
}
}
+ }
ctx->v = vt102_new (&size);
ctx->h = history_new (history);
mainloop (ctx, ansi, server_socket, client_socket);
- }
if (ansi) {
ansi->close (ansi);
@@ -820,7 +832,7 @@ main (int argc, char *argv[])
if (pid_file)
unlink (pid_file);
- if (!oflags['H'])
+ if (!oflags['H'] && !oflags['I'])
printf ("you have now exited sympathy\n");
return 0;
}