aboutsummaryrefslogtreecommitdiffstats
path: root/apps/clients.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/clients.c')
-rw-r--r--apps/clients.c86
1 files changed, 80 insertions, 6 deletions
diff --git a/apps/clients.c b/apps/clients.c
index b5bafcd..cd7bcee 100644
--- a/apps/clients.c
+++ b/apps/clients.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.4 2008/02/14 10:34:30 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/14 02:46:44 james
* *** empty log message ***
*
@@ -148,8 +151,61 @@ clients_post_select (Clients * cs, Context * ctx, fd_set * rfds,
clients_reap (cs);
}
+
+void
+clients_shutdown (Clients * cs)
+{
+ Client *c;
+
+ for (c = cs->head; c; c = c->next)
+ {
+ c->dead++;
+ }
+
+
+ clients_reap (cs);
+}
+
+
+
+
+
+
int
-clients_output (Clients * cs, void *buf, int len)
+send_status (Clients * cs, char *msg)
+{
+ char mbuf[IPC_MAX_BUF + sizeof (IPC_Msg_status)];
+ IPC_Msg_status *m = (IPC_Msg_status *) mbuf;
+ int len;
+
+ Client *c;
+
+ if (!msg) return;
+ len=strlen(msg)+1;
+
+ if (!len)
+ return;
+ if (len > IPC_MAX_BUF)
+ len = IPC_MAX_BUF;
+
+ m->size = len + sizeof (IPC_Msg_status);
+ m->type = IPC_MSG_TYPE_STATUS;
+ strncpy(m->status,msg, IPC_MAX_BUF);
+ m->status[IPC_MAX_BUF-1]=0;
+
+ for (c = cs->head; c; c = c->next)
+ {
+ if (!c->dead)
+ if (ipc_msg_send (c->s, (IPC_Msg *) m))
+ c->dead++;
+ }
+
+ return len;
+}
+
+
+int
+send_output (Clients * cs, void *buf, int len)
{
char mbuf[IPC_MAX_BUF + sizeof (IPC_Msg_term)];
IPC_Msg_term *m = (IPC_Msg_term *) mbuf;
@@ -178,15 +234,33 @@ clients_output (Clients * cs, void *buf, int len)
}
void
-clients_shutdown (Clients * cs)
+send_history (History * h, Client * c)
{
- Client *c;
+ int rptr = h->wptr;
- for (c = cs->head; c; c = c->next)
+ HISTORY_INC (h, rptr);
+
+ HISTORY_INC (h, rptr);
+ while (rptr != h->wptr)
{
- c->dead++;
+ History_ent *l = &h->lines[rptr];
+ if (l->valid)
+ {
+
+ if (ipc_msg_send_history (c->s, l))
+ c->dead++;
+
+ }
+ HISTORY_INC (h, rptr);
}
+}
+void
+send_vt102 (VT102 * v, Client * c)
+{
+ if (ipc_msg_send_vt102 (c->s, v))
+ c->dead++;
- clients_reap (cs);
}
+
+