aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorjames <>2008-02-23 11:49:23 +0000
committerjames <>2008-02-23 11:49:23 +0000
commitfc338d9b30500f311d9555545477e4ba1775b403 (patch)
treea860ad9af01332c74527e49bac77662af3e99f3b /apps
parent029a61812e82b58803c618ed53df42180106412f (diff)
downloadsympathy-fc338d9b30500f311d9555545477e4ba1775b403.tar.gz
sympathy-fc338d9b30500f311d9555545477e4ba1775b403.tar.bz2
sympathy-fc338d9b30500f311d9555545477e4ba1775b403.zip
*** empty log message ***
Diffstat (limited to 'apps')
-rw-r--r--apps/clients.c6
-rw-r--r--apps/mainloop.c58
-rw-r--r--apps/sympathy.c16
-rw-r--r--apps/usage.c12
4 files changed, 66 insertions, 26 deletions
diff --git a/apps/clients.c b/apps/clients.c
index 069ae40..598121e 100644
--- a/apps/clients.c
+++ b/apps/clients.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.11 2008/02/23 11:48:51 james
+ * *** empty log message ***
+ *
* Revision 1.10 2008/02/22 17:06:59 james
* *** empty log message ***
*
@@ -66,6 +69,9 @@ client_msg (IPC_Msg * m, Context * c)
break;
case IPC_MSG_TYPE_SETBAUD:
tty_set_baud (c->t, m->setbaud.baud);
+ tty_parse_reset (c);
+
+ log_f (c->l, "<baud changed to %d>", m->setbaud.baud);
break;
case IPC_MSG_TYPE_SENDBREAK:
tty_send_break (c->t);
diff --git a/apps/mainloop.c b/apps/mainloop.c
index 7fb269a..ad2812e 100644
--- a/apps/mainloop.c
+++ b/apps/mainloop.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/23 11:48:51 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/22 23:39:30 james
* *** empty log message ***
*
@@ -300,8 +303,29 @@ check_status (Context * c, Clients * cs)
sprintf (ptr, ", %d client%s", status.nclients,
(status.nclients == 1) ? "" : "s");
+ if (c->tp->biterrs)
+ {
+
+ ptr +=
+ sprintf (ptr, ", %d err%s", c->tp->biterrs,
+ (c->tp->biterrs == 1) ? "" : "s");
+
+ if (c->tp->guessed_baud == -1)
+ {
+ ptr += sprintf (ptr, " try higher");
+ }
+ else if (c->tp->guessed_baud > 0)
+ {
+ ptr += sprintf (ptr, " try %d", status.baud / c->tp->guessed_baud);
+ }
+ }
+
*ptr = 0;
+#if 0
+ log_f (c->l, "%s:%d %s", __FILE__, __LINE__, buf);
+#endif
+
if (cs)
send_status (cs, buf);
else
@@ -311,7 +335,7 @@ check_status (Context * c, Clients * cs)
static int
-msg_from_server (ANSI *a,IPC_Msg * m, Context * c)
+msg_from_server (ANSI * a, IPC_Msg * m, Context * c)
{
switch (m->hdr.type)
{
@@ -330,10 +354,11 @@ msg_from_server (ANSI *a,IPC_Msg * m, Context * c)
*(c->v) = m->vt102.vt102;
- if (a->one_shot) {
- a->one_shot(a,&c->v->crt);
- return 1;
- }
+ if (a->one_shot)
+ {
+ a->one_shot (a, &c->v->crt);
+ return 1;
+ }
//FIXME HTML hook
break;
case IPC_MSG_TYPE_TERM:
@@ -345,7 +370,7 @@ msg_from_server (ANSI *a,IPC_Msg * m, Context * c)
default:
fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
}
-return 0;
+ return 0;
}
@@ -357,6 +382,8 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
Context c = { 0 };
Clients *clients;
+ c.tp = tty_parser_new ();
+ c.u = utf8_new ();
c.v = vt102_new ();
c.h = history_new (nhistory);
@@ -401,7 +428,7 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
for (;;)
{
- struct timeval tv = { 1, 0 };
+ struct timeval tv = { 0, 250000 };
if ((c.d) && (c.d->disconnect))
break;
@@ -476,18 +503,19 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
/*any data from the server */
if (client_socket)
{
- int one_shot;
+ int one_shot;
if (socket_post_select (client_socket, &rfds, &wfds))
break;
while (client_socket->msg)
{
- if (msg_from_server (ansi,client_socket->msg, &c))
- one_shot++;
-
+ if (msg_from_server (ansi, client_socket->msg, &c))
+ one_shot++;
+
socket_consume_msg (client_socket);
}
- if (one_shot) break;
+ if (one_shot)
+ break;
}
@@ -495,10 +523,10 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
if (ansi)
{
if (ansi->dispatch)
- ansi->dispatch (ansi, &c);
+ ansi->dispatch (ansi, &c);
- if (ansi->update)
- ansi->update (ansi, &c);
+ if (ansi->update)
+ ansi->update (ansi, &c);
}
}
diff --git a/apps/sympathy.c b/apps/sympathy.c
index 4ea7bf0..b24e6d0 100644
--- a/apps/sympathy.c
+++ b/apps/sympathy.c
@@ -6,10 +6,14 @@
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] =
+ "$Id$";
/*
* $Log$
+ * Revision 1.12 2008/02/23 11:48:52 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/20 20:16:07 james
* *** empty log message ***
*
@@ -471,13 +475,13 @@ main (int argc, char *argv[])
if (oflags['H'])
{
- ansi=ansi_new_html(stdout);
+ ansi = ansi_new_html (stdout);
}
else
{
terminal_register_handlers ();
- ansi=ansi_new_from_terminal(terminal_open(0,1));
- ansi->reset(ansi, NULL);
+ ansi = ansi_new_from_terminal (terminal_open (0, 1));
+ ansi->reset (ansi, NULL);
}
}
@@ -485,7 +489,7 @@ main (int argc, char *argv[])
if (ansi)
{
- ansi->close(ansi);
+ ansi->close (ansi);
terminal_atexit ();
}
@@ -500,6 +504,6 @@ main (int argc, char *argv[])
socket_free (client_socket);
if (!oflags['H'])
- printf ("you have now exited sympathy\n");
+ printf ("you have now exited sympathy\n");
return 0;
}
diff --git a/apps/usage.c b/apps/usage.c
index 1a9273f..b0893d2 100644
--- a/apps/usage.c
+++ b/apps/usage.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.7 2008/02/23 11:48:52 james
+ * *** empty log message ***
+ *
* Revision 1.6 2008/02/20 18:49:11 staffcvs
* *** empty log message ***
*
@@ -40,9 +43,9 @@ usage (void)
fprintf (stderr, "Usage:\n"
"sympathy -t [-K] [-d serialdev|-p] [-b baud] [-f] [-L log]\n"
"sympathy -s [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-F] [-k skt]\n"
- " [-n hlines]\n"
+ " [-n hlines]\n"
"sympathy [-s -c] [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-k skt]\n"
- " [-n hlines]\n"
+ " [-n hlines]\n"
"sympathy -c [-H] -k skt\n"
"sympathy -r id [-H]\n"
"sympathy {-l|-ls}\n"
@@ -81,9 +84,8 @@ usage (void)
" -H instead of connecting the user's terminal to the session\n"
" emit HTML of the current state of the screen on stdout\n"
" -L log activity on the device to the file log\n"
- " -n hlines the number of lines of history to store in the\n"
- " server, that are replayed on connexion\n"
-);
+ " -n hlines the number of lines of history to store in the\n"
+ " server, that are replayed on connexion\n");
exit (1);
}