chiark / gitweb /
*** empty log message ***
[sympathy.git] / apps / sympathyd.c
index 49dd3120bc759b37522d2aca31aeabc9951adc0b..bdf81323008ab1e7967169d7d91c814bcc677493 100644 (file)
@@ -11,6 +11,18 @@ static char rcsid[] =
 
 /*
  * $Log$
+ * Revision 1.12  2008/02/15 03:32:07  james
+ * *** empty log message ***
+ *
+ * Revision 1.11  2008/02/14 16:21:17  james
+ * *** empty log message ***
+ *
+ * Revision 1.10  2008/02/14 10:39:14  james
+ * *** empty log message ***
+ *
+ * Revision 1.9  2008/02/14 10:34:47  james
+ * *** empty log message ***
+ *
  * Revision 1.8  2008/02/14 10:34:30  james
  * *** empty log message ***
  *
@@ -50,6 +62,7 @@ typedef struct
   int baud;
   int crtscts;
   int cd_edge_sec;
+  int blocked;
   int bootstrap;
 } Status;
 
@@ -71,6 +84,7 @@ get_status (TTY * t, Clients * cs)
   status.lines = tty_status.lines;
   status.baud = tty_status.baud;
   status.crtscts = (tty_status.termios.c_cflag & CRTSCTS) ? 1 : 0;
+  status.blocked = tty_status.blocked;
 
   cd = (tty_status.lines & TIOCM_CD) ? 1 : 0;
 
@@ -174,7 +188,7 @@ log_line_changes (Context * ctx, int old, int new)
 }
 
 static char *
-do_line (char *ptr,int lines, int line)
+do_line (char *ptr, int lines, int line)
 {
   char *lname;
 
@@ -207,8 +221,11 @@ check_status (Context * c, Clients * cs)
 
   log_line_changes (c, old_status.lines, status.lines);
 
-  t=c->t->name;
-  if (!strncmp(t,"/dev/",5)) t+=5;
+  ptr += sprintf (ptr, "CTRL-B ");
+
+  t = c->t->name;
+  if (!strncmp (t, "/dev/", 5))
+    t += 5;
   while (*t)
     *(ptr++) = *(t++);
 
@@ -219,13 +236,23 @@ check_status (Context * c, Clients * cs)
   ptr = do_line (ptr, status.lines, TIOCM_DTR);
   ptr = do_line (ptr, status.lines, TIOCM_DSR);
   ptr = do_line (ptr, status.lines, TIOCM_RI);
+  ptr = do_line (ptr, status.lines, TIOCM_CD);
 
-  if (status.crtscts) {
-       t=", Flow";
-  while (*t)
-    *(ptr++) = *(t++);
+  if (status.blocked)
+    {
+      t = ", Locked";
+      while (*t)
+        *(ptr++) = *(t++);
+    }
+
+  if (status.crtscts)
+    {
+      t = ", Flow";
+      while (*t)
+        *(ptr++) = *(t++);
     }
+
+#if 0
   if (status.lines & TIOCM_CD)
     {
       ptr +=
@@ -238,8 +265,11 @@ check_status (Context * c, Clients * cs)
         sprintf (ptr, ", Off %d.%d", status.cd_edge_sec / 60,
                  status.cd_edge_sec % 60);
     }
+#endif
 
-  ptr += sprintf (ptr, ", %d client%s", status.nclients,(status.nclients==1) ? "":"s");
+  ptr +=
+    sprintf (ptr, ", %d client%s", status.nclients,
+             (status.nclients == 1) ? "" : "s");
 
   *ptr = 0;
 
@@ -255,13 +285,19 @@ main (int argc, char *argv[])
   Clients *clients;
 
 
+#if 0
+  construct_possible_lock_files ("/dev/modem");
+  return 0;
+#endif
+
   s = socket_listen ("socket");
 
   c.t = ptty_open (NULL, NULL);
   c.v = vt102_new ();
   c.h = history_new (200);
   c.l = file_log_new ("log");
-  c.k = keydis_vt102_new (&c);
+  c.k = keydis_vt102_new ();
+  c.d = NULL;
 
 
   clients = clients_new ();