# $Id$
#
# $Log$
+# Revision 1.6 2008/02/14 10:34:30 james
+# *** empty log message ***
+#
# Revision 1.5 2008/02/14 02:46:44 james
# *** empty log message ***
#
sympathy_LDADD = ../src/libsympathy.a -lutil
sympathyd_SOURCES = sympathyd.c clients.c client.c
-sympathyd_LDADD = ../src/libsympathy.la -lutil
+sympathyd_LDADD = ../src/libsympathy.a -lutil
AM_CFLAGS=-g -Werror
/*
* $Log$
+ * Revision 1.5 2008/02/14 10:34:47 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/14 10:34:30 james
* *** empty log message ***
*
vt102_parse (c, m->term.term, m->term.len);
break;
case IPC_MSG_TYPE_STATUS:
- vt102_status_line(c->v,m->status.status);
- break;
+ vt102_status_line (c->v, m->status.status);
+ break;
default:
fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
}
/*
* $Log$
+ * Revision 1.5 2008/02/14 10:34:47 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/14 10:34:30 james
* *** empty log message ***
*
Client *c;
- if (!msg) return;
- len=strlen(msg)+1;
+ if (!msg)
+ return;
+ len = strlen (msg) + 1;
if (!len)
return;
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;
+ strncpy (m->status, msg, IPC_MAX_BUF);
+ m->status[IPC_MAX_BUF - 1] = 0;
for (c = cs->head; c; c = c->next)
{
c->dead++;
}
-
-
/*
* $Log$
+ * Revision 1.5 2008/02/14 10:34:47 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/14 10:34:30 james
* *** empty log message ***
*
/* clients.c */
-extern void client_free(Client *c);
-extern Client *clients_new_client(Clients *cs, Socket *s, Context *ctx);
-extern void clients_reap(Clients *cs);
-extern Clients *clients_new(void);
-extern void clients_pre_select(Clients *cs, fd_set *rfds, fd_set *wfds);
-extern void clients_post_select(Clients *cs, Context *ctx, fd_set *rfds, fd_set *wfds);
-extern void clients_shutdown(Clients *cs);
-
-extern int send_output(Clients *cs, void *buf, int len);
-extern int send_status(Clients *cs, char *msg);
-extern void send_history(History *h, Client *c);
-extern void send_vt102(VT102 *v, Client *c);
+extern void client_free (Client * c);
+extern Client *clients_new_client (Clients * cs, Socket * s, Context * ctx);
+extern void clients_reap (Clients * cs);
+extern Clients *clients_new (void);
+extern void clients_pre_select (Clients * cs, fd_set * rfds, fd_set * wfds);
+extern void clients_post_select (Clients * cs, Context * ctx, fd_set * rfds,
+ fd_set * wfds);
+extern void clients_shutdown (Clients * cs);
+
+extern int send_output (Clients * cs, void *buf, int len);
+extern int send_status (Clients * cs, char *msg);
+extern void send_history (History * h, Client * c);
+extern void send_vt102 (VT102 * v, Client * c);
#endif
/*
* $Log$
+ * 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 ***
*
int baud;
int crtscts;
int cd_edge_sec;
+ int blocked;
int bootstrap;
} Status;
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;
ptr = do_line (ptr, status.lines, TIOCM_DSR);
ptr = do_line (ptr, status.lines, TIOCM_RI);
+ if (status.blocked)
+ {
+ t = ", Locked";
+ while (*t)
+ *(ptr++) = *(t++);
+ }
+
if (status.crtscts)
{
t = ", Flow";
extern void vt102_free(VT102 *v);
/* tty.c */
extern void tty_pre_select(TTY *t, fd_set *rfds, fd_set *wfds);
+extern int tty_get_status(TTY *t, TTY_Status *s);
/* keydis.c */
extern KeyDis *keydis_vt102_new(Context *c);
extern KeyDis *keydis_ipc_new(Socket *s);
extern int ipc_msg_send_vt102(Socket *s, VT102 *v);
extern int ipc_msg_send_key(Socket *s, int key);
extern int ipc_msg_send_term(Socket *s, void *buf, int len);
+extern int ipc_msg_send_status(Socket *s, char *buf);
/* slide.c */
extern void slide_free(Slide *s);
extern void slide_consume(Slide *s, int n);
/*
* $Log$
+ * Revision 1.4 2008/02/14 10:39:14 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/13 09:12:21 james
* *** empty log message ***
*
t->wfd = t->fd;
t->size.x = winsize.ws_row;
t->size.y = winsize.ws_col;
+ t->blocked = 0;
return (TTY *) t;
}
/*
* $Log$
+ * Revision 1.8 2008/02/14 10:39:14 james
+ * *** empty log message ***
+ *
* Revision 1.7 2008/02/14 01:55:57 james
* *** empty log message ***
*
{
TERMINAL *t;
pid_t child;
- char name[1024];
struct termios termios;
t = (TERMINAL *) malloc (sizeof (TERMINAL));
+ strcpy(t->name,"terminal");
t->rfd = rfd;
t->wfd = wfd;
t->recv = terminal_read;
t->xmit = terminal_write;
t->close = terminal_close;
+ t->blocked = 0;
terminal_getsize ((TTY *) t);
/*
* $Log$
+ * Revision 1.8 2008/02/14 10:36:18 james
+ * *** empty log message ***
+ *
* Revision 1.7 2008/02/14 10:34:30 james
* *** empty log message ***
*
tty_get_status (TTY * t, TTY_Status * s)
{
- s->lines=0;
+ s->lines = 0;
ioctl (t->rfd, TIOCMGET, &s->lines);
if (tcgetattr (t->rfd, &s->termios))
return -1;
-
- s->baud=speed_t_to_baud(cfgetispeed(&s->termios));
+
+ s->baud = speed_t_to_baud (cfgetispeed (&s->termios));
+ s->blocked = t->blocked;
return 0;
}
/*
* $Log$
+ * Revision 1.7 2008/02/14 10:36:18 james
+ * *** empty log message ***
+ *
* Revision 1.6 2008/02/14 10:34:30 james
* *** empty log message ***
*
#define TTY_SIGNATURE \
char name[1024]; \
+ int blocked; \
CRT_Pos size; \
void (*close)(struct TTY_struct *); \
int (*recv)(struct TTY_struct *,void *buf,int len); \
typedef struct {
int lines;
+ int blocked;
struct termios termios;
int baud;
} TTY_Status;
/*
* $Log$
+ * Revision 1.28 2008/02/14 10:34:30 james
+ * *** empty log message ***
+ *
* Revision 1.27 2008/02/14 02:46:45 james
* *** empty log message ***
*
v->current_line = v->pos;
}
- vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
}
vt102_parse (Context * c, char *buf, int len)
vt102_save_state (v);
- vt102_status_line (v, "VT102 foo bar baz I'm the urban spaceman baby");
+ vt102_status_line (v, "");
}
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] =
+ "$Id$";
/*
* $Log$
- * Revision 1.4 2008/02/14 00:57:58 james
+ * Revision 1.5 2008/02/14 10:34:30 james
* *** empty log message ***
*
- * Revision 1.3 2008/02/13 18:05:06 james
+ * Revision 1.7 2008/02/14 02:46:44 james
* *** empty log message ***
*
- * Revision 1.2 2008/02/04 11:30:57 james
+ * Revision 1.6 2008/02/14 00:57:58 james
* *** empty log message ***
*
- * Revision 1.1 2008/02/03 16:20:24 james
+ * Revision 1.5 2008/02/13 18:05:06 james
+ * *** empty log message ***
+ *
+ * Revision 1.4 2008/02/13 17:21:55 james
+ * *** empty log message ***
+ *
+ * Revision 1.3 2008/02/08 15:06:52 james
+ * *** empty log message ***
+ *
+ * Revision 1.2 2008/02/07 15:42:49 james
+ * *** empty log message ***
+ *
+ * Revision 1.1 2008/02/05 14:25:49 james
* *** empty log message ***
*
*/
-#include "sympathy.h"
+#include <sympathy.h>
+
-int main(int argc,char *argv[])
+int
+main (int argc, char *argv[])
{
+ fd_set rfds, wfds;
+ ANSI a = { 0 };
+ Context c;
+
+
+ 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);
+
+ terminal_register_handlers ();
+ a.terminal = terminal_open (0, 1);
+
+ ansi_reset (&a, NULL);
+
+ for (;;)
+ {
+ struct timeval tv = { 10, 0 };
+
+ FD_ZERO (&rfds);
+ FD_ZERO (&wfds);
+
+ tty_pre_select (c.t, &rfds, &wfds);
+ tty_pre_select (a.terminal, &rfds, &wfds);
+
+
+ select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
+
+ if (FD_ISSET (c.t->rfd, &rfds))
+ {
+ if (vt102_dispatch(&c)) break;
+ }
+
+ ansi_dispatch (&a, &c);
+ ansi_update (&a, &c);
+
+ }
-return 0;
+ ansi_terminal_reset (&a);
+ terminal_atexit ();
+ printf ("QUAT\n");
}