From 6fb644311ee9bf169a12bb9b2d9b081c16fc08f0 Mon Sep 17 00:00:00 2001 From: james <> Date: Thu, 6 Mar 2008 16:49:39 +0000 Subject: *** empty log message *** --- apps/mainloop.c | 20 ++++++++++++-------- apps/mainloop.h | 5 ++++- apps/sympathy.c | 32 +++++++++++++++++++------------- 3 files changed, 35 insertions(+), 22 deletions(-) (limited to 'apps') diff --git a/apps/mainloop.c b/apps/mainloop.c index 5772214..e266179 100644 --- a/apps/mainloop.c +++ b/apps/mainloop.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.24 2008/03/06 16:49:39 james + * *** empty log message *** + * * Revision 1.23 2008/03/06 16:49:05 james * *** empty log message *** * @@ -380,7 +383,7 @@ check_status (Context * c, Clients * cs) static int msg_from_server (ANSI * a, IPC_Msg * m, Context * c) { -int err=0; + int err = 0; switch (m->hdr.type) { @@ -401,11 +404,11 @@ int err=0; if (a->one_shot) { a->one_shot (a, &c->v->crt); - err++;/*Simulate a fatal write error enclosing tty*/ + err++; /*Simulate a fatal write error enclosing tty */ } break; case IPC_MSG_TYPE_TERM: - err+=tty_parse (c, m->term.term, m->term.len); + err += tty_parse (c, m->term.term, m->term.len); break; case IPC_MSG_TYPE_STATUS: cmd_new_status (c->d, c, m->status.status); @@ -418,7 +421,8 @@ int err=0; void -mainloop ( Context *c, ANSI *ansi,Socket * server_socket, Socket * client_socket) +mainloop (Context * c, ANSI * ansi, Socket * server_socket, + Socket * client_socket) { fd_set rfds, wfds; Clients *clients; @@ -535,7 +539,7 @@ mainloop ( Context *c, ANSI *ansi,Socket * server_socket, Socket * client_socket if (clients) send_output (clients, buf, red); if (tty_parse (c, buf, red)) - break; + break; } } @@ -550,7 +554,7 @@ mainloop ( Context *c, ANSI *ansi,Socket * server_socket, Socket * client_socket while (client_socket->msg) { if (msg_from_server (ansi, client_socket->msg, c)) - break; + break; socket_consume_msg (client_socket); } @@ -562,11 +566,11 @@ mainloop ( Context *c, ANSI *ansi,Socket * server_socket, Socket * client_socket { if (ansi->dispatch) if (ansi->dispatch (ansi, c)) - break; + break; if (ansi->update) if (ansi->update (ansi, c)) - break; + break; } } diff --git a/apps/mainloop.h b/apps/mainloop.h index e85b784..2c7f2b9 100644 --- a/apps/mainloop.h +++ b/apps/mainloop.h @@ -12,6 +12,9 @@ /* * $Log$ + * Revision 1.9 2008/03/06 16:49:39 james + * *** empty log message *** + * * Revision 1.8 2008/03/06 16:49:05 james * *** empty log message *** * @@ -43,5 +46,5 @@ #include -extern void mainloop (Context *,ANSI *a,Socket *,Socket *); +extern void mainloop (Context *, ANSI * a, Socket *, Socket *); #endif /* __MAINLOOP_H__ */ diff --git a/apps/sympathy.c b/apps/sympathy.c index dc9dd66..33c47e7 100644 --- a/apps/sympathy.c +++ b/apps/sympathy.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.34 2008/03/06 16:49:39 james + * *** empty log message *** + * * Revision 1.33 2008/03/06 16:49:05 james * *** empty log message *** * @@ -436,13 +439,13 @@ get_hostname (void) int main (int argc, char *argv[]) { - Context ctx_store={0},*ctx=&ctx_store; + Context ctx_store = { 0 }, *ctx = &ctx_store; int c; extern char *optarg; extern int optind, opterr, optopt; CRT_Pos size = { VT102_COLS_80, VT102_ROWS_24 }; - ANSI *ansi=NULL; + ANSI *ansi = NULL; int csnok_pipe[2] = { 0 }; int csnok = 0; @@ -551,7 +554,7 @@ main (int argc, char *argv[]) if (oflags['c'] && oflags['s'] && oflags['F']) fatal_moan ("-F is incompatible with -c -s"); - if (oflags['H'] && oflags['N']) + if (oflags['H'] && oflags['N']) fatal_moan ("-H is incompatible with -N"); /*implement server and client: this process forks. The parent */ @@ -620,8 +623,8 @@ main (int argc, char *argv[]) if (oflags['c'] && !oflags['k'] && !oflags['r']) fatal_moan ("-c requires a socket to be specified with -s or -k or -r"); - if ((oflags['H'] || oflags['N'] || oflags['I'] ) && oflags['s']) - fatal_moan("-s is incompatible with -H, -N and -I"); + if ((oflags['H'] || oflags['N'] || oflags['I']) && oflags['s']) + fatal_moan ("-s is incompatible with -H, -N and -I"); if ((oflags['p'] || oflags['d'] || oflags['K'] || oflags['b'] || oflags['f'] || oflags['L'] || oflags['R'] || oflags['P']) && oflags['c']) @@ -806,10 +809,12 @@ main (int argc, char *argv[]) if (oflags['c'] || oflags['t']) { - if (oflags['N']) { - ctx->r=rx_new_raw(0,1); - ansi=ansi_new_raw(0,1); - } else if (oflags['H']) + if (oflags['N']) + { + ctx->r = rx_new_raw (0, 1); + ansi = ansi_new_raw (0, 1); + } + else if (oflags['H']) { ansi = ansi_new_html (stdout); } @@ -821,16 +826,17 @@ main (int argc, char *argv[]) oflags['u'] ? 0 : 1); ansi->reset (ansi, NULL); } - if (oflags['I']) { - //FIXME ... - } + if (oflags['I']) + { + //FIXME ... + } } ctx->v = vt102_new (&size); ctx->h = history_new (history); - mainloop (ctx,ansi, server_socket, client_socket); + mainloop (ctx, ansi, server_socket, client_socket); // mainloop (tty, server_socket, client_socket, ansi, log, history, &size); -- cgit v1.2.3