aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ansi.c4
-rw-r--r--src/cmd.c40
-rw-r--r--src/crt.h5
-rw-r--r--src/ipc.c7
-rw-r--r--src/keydis.c21
-rw-r--r--src/prototypes.h11
-rw-r--r--src/ptty.c5
-rw-r--r--src/serial.c5
-rw-r--r--src/terminal.c5
-rw-r--r--src/tty.c14
-rw-r--r--src/tty.h6
-rw-r--r--src/vt102.c98
-rw-r--r--src/vt102.h8
13 files changed, 143 insertions, 86 deletions
diff --git a/src/ansi.c b/src/ansi.c
index 408efd4..4113a36 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.35 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.34 2008/02/27 09:42:53 james
* *** empty log message ***
*
@@ -948,6 +951,7 @@ ansi_update (ANSI * a, Context * c)
{
ansi_history (a, c->h);
ansi_draw (a, &c->v->crt);
+ tty_length(a->terminal,c->v->crt.size.y);
}
static void
diff --git a/src/cmd.c b/src/cmd.c
index a2cf7cd..7e86977 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.5 2008/02/28 15:37:06 james
* *** empty log message ***
*
@@ -52,12 +55,13 @@ cmd_parse (Cmd * c, Context * ctx, char *buf)
else if (!strcmp (buf, "reset"))
ctx->k->reset (ctx->k, ctx);
else if (!strncmp (buf, "width", 5))
- ctx->k->set_size (ctx->k, ctx,atoi(buf+5),0);
+ ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0);
else if (!strncmp (buf, "height", 6))
- ctx->k->set_size (ctx->k, ctx,0,atoi(buf+6));
- else return -1;
+ ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6));
+ else
+ return -1;
-return 0;
+ return 0;
}
@@ -68,7 +72,7 @@ cmd_show_status (Cmd * c, Context * ctx)
if (!ctx->v)
return;
- if (c->error)
+ if (c->error)
vt102_status_line (ctx->v, "Command not recognized - press any key");
else if (!c->active)
vt102_status_line (ctx->v, c->csl);
@@ -81,20 +85,24 @@ int
cmd_key (Cmd * c, Context * ctx, int key)
{
- if (c->error) {
- c->error=0;
- c->active=0;
- cmd_show_status (c, ctx);
- return 0;
- }
+ if (c->error)
+ {
+ c->error = 0;
+ c->active = 0;
+ cmd_show_status (c, ctx);
+ return 0;
+ }
if (key == 13)
{
- if (cmd_parse (c, ctx, c->buf + 1)) {
- c->error++;
- } else{
- c->active = 0;
- }
+ if (cmd_parse (c, ctx, c->buf + 1))
+ {
+ c->error++;
+ }
+ else
+ {
+ c->active = 0;
+ }
cmd_show_status (c, ctx);
return 0;
}
diff --git a/src/crt.h b/src/crt.h
index bc58a5d..d935255 100644
--- a/src/crt.h
+++ b/src/crt.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.14 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.13 2008/02/27 09:42:22 james
* *** empty log message ***
*
@@ -56,7 +59,7 @@
#ifndef __CRT_H__
#define __CRT_H__
-#define CRT_ROWS 25
+#define CRT_ROWS 60
#define CRT_COLS 132
#define CRT_CELS (CRT_ROWS*CRT_COLS)
diff --git a/src/ipc.c b/src/ipc.c
index 4802810..720cadd 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.5 2008/02/28 11:27:48 james
* *** empty log message ***
*
@@ -220,13 +223,13 @@ ipc_msg_send_hangup (Socket * s)
}
int
-ipc_msg_send_setsize (Socket * s,CRT_Pos size)
+ipc_msg_send_setsize (Socket * s, CRT_Pos size)
{
IPC_Msg_setsize m;
m.size = sizeof (m);
m.type = IPC_MSG_TYPE_SETSIZE;
- m.winsize=size;
+ m.winsize = size;
return ipc_msg_send (s, (IPC_Msg *) & m);
}
diff --git a/src/keydis.c b/src/keydis.c
index 3aed96e..c6e4db2 100644
--- a/src/keydis.c
+++ b/src/keydis.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.8 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.7 2008/02/28 16:37:16 james
* *** empty log message ***
*
@@ -124,14 +127,14 @@ keydis_ipc_hangup (KeyDis * _t, Context * c)
static int
-keydis_ipc_set_size (KeyDis * _t, Context * c,int w,int h)
+keydis_ipc_set_size (KeyDis * _t, Context * c, int w, int h)
{
-CRT_Pos p={w,h};
+ CRT_Pos p = { w, h };
KeyDis_IPC *t = (KeyDis_IPC *) _t;
- vt102_resize(c,p);
- ipc_msg_send_setsize (t->s,p);
+ vt102_resize (c, p);
+ ipc_msg_send_setsize (t->s, p);
return 0;
}
@@ -142,7 +145,7 @@ keydis_ipc_reset (KeyDis * _t, Context * c)
{
KeyDis_IPC *t = (KeyDis_IPC *) _t;
- vt102_reset(c);
+ vt102_reset (c);
ipc_msg_send_reset (t->s);
return 0;
@@ -212,12 +215,12 @@ keydis_vt102_hangup (KeyDis * _t, Context * c)
}
static int
-keydis_vt102_set_size (KeyDis * _t, Context * c,int w, int h)
+keydis_vt102_set_size (KeyDis * _t, Context * c, int w, int h)
{
KeyDis_VT102 *t = (KeyDis_VT102 *) _t;
- CRT_Pos p={w,h};
-
- vt102_resize(c,p);
+ CRT_Pos p = { w, h };
+
+ vt102_resize (c, p);
return 0;
}
diff --git a/src/prototypes.h b/src/prototypes.h
index cd4fcd0..e96cb1b 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -17,6 +17,7 @@ extern char *libsympathy_version(void);
/* vt102.c */
extern int vt102_cmd_length[128];
extern int vt102_cmd_termination[128];
+extern void vt102_crt_update(Context *c);
extern void vt102_do_resize(Context *c);
extern void vt102_log_line(Context *c, int line);
extern void vt102_history(Context *c, CRT_Pos t, CRT_Pos b);
@@ -174,9 +175,9 @@ extern UTF8 *utf8_new(void);
extern int utf8_encode(char *ptr, int ch);
extern void utf8_emit(TTY *t, int ch);
/* vt102_charset.c */
-extern uint32_t vt102_charset_c0[VT102_CHARSET_SIZE];
-extern uint32_t vt102_charset_us[VT102_CHARSET_SIZE];
-extern uint32_t vt102_charset_uk[VT102_CHARSET_SIZE];
-extern uint32_t vt102_charset_vt52[VT102_CHARSET_SIZE];
-extern uint32_t vt102_charset_gl[VT102_CHARSET_SIZE];
+extern uint32_t vt102_charset_c0[128];
+extern uint32_t vt102_charset_us[128];
+extern uint32_t vt102_charset_uk[128];
+extern uint32_t vt102_charset_vt52[128];
+extern uint32_t vt102_charset_gl[128];
extern uint32_t *charset_from_csid[];
diff --git a/src/ptty.c b/src/ptty.c
index 3be35f2..f8b6b9f 100644
--- a/src/ptty.c
+++ b/src/ptty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.16 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.15 2008/02/27 09:42:53 james
* *** empty log message ***
*
@@ -161,7 +164,7 @@ ptty_open (char *path, char *argv[], CRT_Pos * size)
client_termios (&ctermios);
- winsize.ws_row = size ? size->y : VT102_ROWS;
+ winsize.ws_row = size ? size->y : VT102_ROWS_24;
winsize.ws_col = size ? size->x : VT102_COLS_80;
child = forkpty (&fd, name, &ctermios, &winsize);
diff --git a/src/serial.c b/src/serial.c
index fe08594..e269c83 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.12 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/26 23:23:17 james
* *** empty log message ***
*
@@ -208,7 +211,7 @@ serial_open (char *path, int lock_mode)
t->rfd = t->fd;
t->wfd = t->fd;
t->size.x = VT102_COLS_80;
- t->size.y = VT102_ROWS;
+ t->size.y = VT102_ROWS_24;
t->blocked = serial_lock_check (t->lock);
t->hanging_up = 0;
diff --git a/src/terminal.c b/src/terminal.c
index 72a7764..a3be09b 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.12 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/26 23:56:12 james
* *** empty log message ***
*
@@ -110,7 +113,7 @@ terminal_close (TTY * _t)
t->xmit (_t, "\017", 1); //Select G0
t->xmit (_t, "\033[r", 3); //No margins
t->xmit (_t, "\033[0m", 4); //Default attributes
- i = sprintf (buf, "\033[%d;%dH", CRT_ROWS + 1, 1); //Cursor to bottom
+ i = sprintf (buf, "\033[%d;%dH", t->displayed_length ?(t->displayed_length+1): (CRT_ROWS +1), 1); //Cursor to bottom
t->xmit (_t, buf, i);
t->xmit (_t, "\033[J", 3); //erase rest of screen
diff --git a/src/tty.c b/src/tty.c
index f27afea..df7c13f 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.19 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.18 2008/02/28 16:37:16 james
* *** empty log message ***
*
@@ -340,13 +343,18 @@ tty_hangup (TTY * t)
}
+void tty_length(TTY *t,int l)
+{
+t->displayed_length=l;
+}
-void tty_winch(TTY * t,CRT_Pos size)
+void
+tty_winch (TTY * t, CRT_Pos size)
{
struct winsize sz = { 0 };
- sz.ws_col=size.x;
- sz.ws_row=size.y;
+ sz.ws_col = size.x;
+ sz.ws_row = size.y;
ioctl (t->wfd, TIOCSWINSZ, &sz);
}
diff --git a/src/tty.h b/src/tty.h
index 76f9fbb..d91500e 100644
--- a/src/tty.h
+++ b/src/tty.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.12 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -63,7 +66,8 @@
int rfd; \
int wfd; \
int hanging_up; \
- struct timeval hangup_clock;
+ struct timeval hangup_clock; \
+ int displayed_length;
#define TTY_BITFREQ_LEN 10
diff --git a/src/vt102.c b/src/vt102.c
index 1d3709b..7488803 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.52 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.51 2008/02/28 16:37:16 james
* *** empty log message ***
*
@@ -402,9 +405,11 @@ in_margins (VT102 * v, CRT_Pos p)
return 1;
}
-void vt102_crt_update(Context *c)
+
+void
+vt102_crt_update (Context * c)
{
-VT102 *v=c->v;
+ VT102 *v = c->v;
v->crt.pos = v->pos;
v->crt.hide_cursor =
@@ -419,26 +424,28 @@ VT102 *v=c->v;
if (c->d)
cmd_show_status (c->d, c);
}
-void vt102_do_resize(Context *c)
+
+void
+vt102_do_resize (Context * c)
{
-VT102 *v=c->v;
+ VT102 *v = c->v;
- v->crt.size = v->current_size;
- v->crt.size.y++;
- v->screen_end = v->current_size;
- v->screen_end.x--;
- v->screen_end.y--;
- v->top_margin = v->screen_start;
- v->bottom_margin = v->screen_end;
- vt102_cursor_home (v);
- crt_cls (&v->crt);
+ v->crt.size = v->current_size;
+ v->crt.size.y++;
+ v->screen_end = v->current_size;
+ v->screen_end.x--;
+ v->screen_end.y--;
+ v->top_margin = v->screen_start;
+ v->bottom_margin = v->screen_end;
+ vt102_cursor_home (v);
+ crt_cls (&v->crt);
- if (c->t)
- tty_winch(c->t,v->current_size);
+ if (c->t)
+ tty_winch (c->t, v->current_size);
- log_f(c->l,"<size now %dx%d>", v->current_size.x,v->current_size.y);
-vt102_crt_update(c);
+ log_f (c->l, "<size now %dx%d>", v->current_size.x, v->current_size.y);
+ vt102_crt_update (c);
}
@@ -750,9 +757,9 @@ vt102_insert_into_line (VT102 * v, CRT_Pos p)
void
-vt102_change_mode (Context *c, int private, char *ns, int set)
+vt102_change_mode (Context * c, int private, char *ns, int set)
{
- VT102 *v=c->v;
+ VT102 *v = c->v;
int m;
@@ -794,7 +801,7 @@ vt102_change_mode (Context *c, int private, char *ns, int set)
private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
VT102_COLS_80;
- vt102_do_resize(c);
+ vt102_do_resize (c);
break;
}
@@ -808,9 +815,9 @@ vt102_change_mode (Context *c, int private, char *ns, int set)
}
void
-vt102_parse_mode_string (Context *c, char *buf, int len)
+vt102_parse_mode_string (Context * c, char *buf, int len)
{
- VT102 *v=c->v;
+ VT102 *v = c->v;
int private = 0;
char last = buf[len - 1];
char num[4];
@@ -1627,9 +1634,9 @@ vt102_parser_reset (VT102_parser * p)
void
-vt102_reset_state (Context *c)
+vt102_reset_state (Context * c)
{
- VT102 *v=c->v;
+ VT102 *v = c->v;
vt102_parser_reset (&v->parser);
v->attr = CRT_ATTR_NORMAL;
@@ -1639,7 +1646,7 @@ vt102_reset_state (Context *c)
v->current_size = v->original_size;
- vt102_do_resize(c);
+ vt102_do_resize (c);
memset (v->modes, 0, VT102_NMODES);
memset (v->private_modes, 0, VT102_NMODES);
@@ -1856,7 +1863,7 @@ vt102_parse_char (Context * c, int ch)
#endif
}
- vt102_crt_update(c);
+ vt102_crt_update (c);
}
@@ -2032,7 +2039,7 @@ vt102_send (Context * c, uint8_t key)
void
vt102_reset (Context * c)
{
- VT102 *v=c->v;
+ VT102 *v = c->v;
VT102_parser *p = &v->parser;
@@ -2084,14 +2091,14 @@ vt102_new (CRT_Pos * size)
if (v->original_size.x > VT102_MAX_COLS)
v->original_size.x = VT102_MAX_COLS;
- if (v->original_size.y > VT102_ROWS)
- v->original_size.y = VT102_ROWS;
+ if (v->original_size.y > VT102_MAX_ROWS)
+ v->original_size.y = VT102_MAX_ROWS;
}
else
{
v->original_size.x = VT102_COLS_80;
- v->original_size.y = VT102_ROWS;
+ v->original_size.y = VT102_ROWS_24;
}
return v;
@@ -2103,25 +2110,28 @@ vt102_set_ansi (VT102 * v, int ansi)
v->xn_glitch = ansi ? 0 : 1;
}
-void vt102_resize(Context *c,CRT_Pos size)
+void
+vt102_resize (Context * c, CRT_Pos size)
{
- log_f(c->l,"<size change to %dx%d requested>", size.x,size.y);
+ log_f (c->l, "<size change to %dx%d requested>", size.x, size.y);
- if (!size.x) size.x=c->v->current_size.x;
- if (!size.y) size.y=c->v->current_size.y;
+ if (!size.x)
+ size.x = c->v->current_size.x;
+ if (!size.y)
+ size.y = c->v->current_size.y;
- if (size.x < 1)
- size.x = 1;
- if (size.y < 1)
- size.y = 1;
+ if (size.x < 1)
+ size.x = 1;
+ if (size.y < 1)
+ size.y = 1;
- if (size.x > VT102_MAX_COLS)
- size.x = VT102_MAX_COLS;
- if (size.y > VT102_ROWS)
- size.y = VT102_ROWS;
+ if (size.x > VT102_MAX_COLS)
+ size.x = VT102_MAX_COLS;
+ if (size.y > VT102_MAX_ROWS)
+ size.y = VT102_MAX_ROWS;
- c->v->current_size=size;
- vt102_do_resize(c);
+ c->v->current_size = size;
+ vt102_do_resize (c);
}
void
diff --git a/src/vt102.h b/src/vt102.h
index e09fbf6..02fdf99 100644
--- a/src/vt102.h
+++ b/src/vt102.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.21 2008/02/28 16:57:52 james
+ * *** empty log message ***
+ *
* Revision 1.20 2008/02/27 09:42:22 james
* *** empty log message ***
*
@@ -79,7 +82,8 @@
#define VT102_CMD_LEN 128
-#define VT102_ROWS 24
+#define VT102_MAX_ROWS ((CRT_ROWS) - 1)
+#define VT102_ROWS_24 24
#define VT102_COLS_132 132
#define VT102_COLS_80 80
#define VT102_MAX_COLS VT102_COLS_132
@@ -92,7 +96,7 @@ typedef struct
{
int in_escape;
int in_cmd;
-
+
int cmd_ptr;
int cmd_more_bytes;
int cmd_termination;