aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <>2008-02-28 11:27:48 +0000
committerjames <>2008-02-28 11:27:48 +0000
commite0ace86247de9c0f91cfb87188eff51df5508c7a (patch)
treedcc895eadd738a0d9cfa4d26ee94f9abd217ff2c
parent376040f1e7ed6e46baa2fe48ae92d3ea8a2518cd (diff)
downloadsympathy-e0ace86247de9c0f91cfb87188eff51df5508c7a.tar.gz
sympathy-e0ace86247de9c0f91cfb87188eff51df5508c7a.tar.bz2
sympathy-e0ace86247de9c0f91cfb87188eff51df5508c7a.zip
*** empty log message ***
-rw-r--r--apps/mainloop.c6
-rw-r--r--src/cmd.c37
-rw-r--r--src/cmd.h4
-rw-r--r--src/ipc.c25
-rw-r--r--src/ipc.h22
-rw-r--r--src/keydis.h7
-rw-r--r--src/prototypes.h12
-rw-r--r--src/vt102.c89
-rw-r--r--sympathy.123
9 files changed, 171 insertions, 54 deletions
diff --git a/apps/mainloop.c b/apps/mainloop.c
index e9c299c..4a3fdca 100644
--- a/apps/mainloop.c
+++ b/apps/mainloop.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.18 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.17 2008/02/27 09:42:53 james
* *** empty log message ***
*
@@ -444,6 +447,9 @@ mainloop (TTY * tty, Socket * server_socket, Socket * client_socket,
}
+ vt102_reset(&c);
+
+
if (server_socket)
{
if (client_socket)
diff --git a/src/cmd.c b/src/cmd.c
index 7105c5b..21a7909 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.4 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/22 17:07:00 james
* *** empty log message ***
*
@@ -29,21 +32,28 @@ cmd_parse (Cmd * c, Context * ctx, char *buf)
{
if (!strcmp (buf, "quit"))
c->disconnect++;
-
- if (!strcmp (buf, "flow"))
+ else if (!strcmp (buf, "flow"))
ctx->k->set_flow (ctx->k, ctx, 1);
- if (!strcmp (buf, "noflow"))
+ else if (!strcmp (buf, "noflow"))
ctx->k->set_flow (ctx->k, ctx, 0);
- if (!strcmp (buf, "ansi"))
+ else if (!strcmp (buf, "ansi"))
ctx->k->set_ansi (ctx->k, ctx, 0);
- if (!strcmp (buf, "noansi"))
+ else if (!strcmp (buf, "noansi"))
ctx->k->set_ansi (ctx->k, ctx, 1);
- if (!strncmp (buf, "baud", 4))
+ else if (!strncmp (buf, "baud", 4))
ctx->k->set_baud (ctx->k, ctx, atoi (buf + 4));
- if (!strncmp (buf, "break", 4))
+ else if (!strcmp (buf, "break"))
ctx->k->send_break (ctx->k, ctx);
- if (!strncmp (buf, "hangup", 4))
+ else if (!strcmp (buf, "hangup"))
ctx->k->hangup (ctx->k, ctx);
+ 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);
+ else if (!strncmp (buf, "height", 6))
+ ctx->k->set_size (ctx->k, ctx,0,atoi(buf+6));
+ else
+ c->error++;
}
@@ -53,18 +63,25 @@ cmd_show_status (Cmd * c, Context * ctx)
if (!ctx->v)
return;
- if (!c->active)
+ 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);
else
vt102_status_line (ctx->v, c->buf);
-
}
int
cmd_key (Cmd * c, Context * ctx, int key)
{
+ if (c->error) {
+ c->error=0;
+ cmd_show_status (c, ctx);
+ return 0;
+ }
+
if (key == 13)
{
cmd_parse (c, ctx, c->buf + 1);
diff --git a/src/cmd.h b/src/cmd.h
index 43a1bbf..15ce41e 100644
--- a/src/cmd.h
+++ b/src/cmd.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.3 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.2 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -28,6 +31,7 @@
typedef struct
{
int active;
+ int error;
int disconnect;
char csl[128];
char buf[128];
diff --git a/src/ipc.c b/src/ipc.c
index 8809f36..4802810 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/22 17:07:00 james
* *** empty log message ***
*
@@ -215,3 +218,25 @@ ipc_msg_send_hangup (Socket * s)
m.type = IPC_MSG_TYPE_HANGUP;
return ipc_msg_send (s, (IPC_Msg *) & m);
}
+
+int
+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;
+
+ return ipc_msg_send (s, (IPC_Msg *) & m);
+}
+
+int
+ipc_msg_send_reset (Socket * s)
+{
+ IPC_Msg_reset m;
+
+ m.size = sizeof (m);
+ m.type = IPC_MSG_TYPE_RESET;
+ return ipc_msg_send (s, (IPC_Msg *) & m);
+}
diff --git a/src/ipc.h b/src/ipc.h
index 91589ed..aed692e 100644
--- a/src/ipc.h
+++ b/src/ipc.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.6 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.5 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -46,6 +49,8 @@
#define IPC_MSG_TYPE_SETFLOW 9
#define IPC_MSG_TYPE_SETANSI 10
#define IPC_MSG_TYPE_HANGUP 11
+#define IPC_MSG_TYPE_SETSIZE 12
+#define IPC_MSG_TYPE_RESET 13
typedef struct
{
@@ -146,6 +151,21 @@ typedef struct
} IPC_Msg_hangup;
+typedef struct
+{
+ int32_t size;
+ int32_t type;
+ CRT_Pos winsize;
+} IPC_Msg_setsize;
+
+
+typedef struct
+{
+ int32_t size;
+ int32_t type;
+} IPC_Msg_reset;
+
+
typedef union
{
@@ -162,6 +182,8 @@ typedef union
IPC_Msg_setflow setflow;
IPC_Msg_setansi setansi;
IPC_Msg_hangup hangup;
+ IPC_Msg_setsize setsize;
+ IPC_Msg_reset reset;
} IPC_Msg;
diff --git a/src/keydis.h b/src/keydis.h
index 21a73f8..ad0de79 100644
--- a/src/keydis.h
+++ b/src/keydis.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.6 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.5 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -45,7 +48,9 @@ struct Context_struct;
int (*send_break)(struct KeyDis_struct *,struct Context_struct *); \
int (*set_flow)(struct KeyDis_struct *,struct Context_struct *,int flow); \
int (*set_ansi)(struct KeyDis_struct *,struct Context_struct *,int ansi); \
- int (*hangup)(struct KeyDis_struct *,struct Context_struct *)
+ int (*hangup)(struct KeyDis_struct *,struct Context_struct *); \
+ int (*reset)(struct KeyDis_struct *,struct Context_struct *); \
+ int (*set_size)(struct KeyDis_struct *,struct Context_struct *,int width, int height)
diff --git a/src/prototypes.h b/src/prototypes.h
index d1de9a9..7d90a8e 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_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);
extern void vt102_clip_cursor(VT102 *v, CRT_Pos tl, CRT_Pos br);
@@ -35,8 +36,8 @@ extern int vt102_cursor_absolute(VT102 *v, int x, int y);
extern int vt102_cursor_relative(VT102 *v, int x, int y);
extern void vt102_delete_from_line(VT102 *v, CRT_Pos p);
extern void vt102_insert_into_line(VT102 *v, CRT_Pos p);
-extern void vt102_change_mode(VT102 *v, int private, char *ns, int set);
-extern void vt102_parse_mode_string(VT102 *v, char *buf, int len);
+extern void vt102_change_mode(Context *c, int private, char *ns, int set);
+extern void vt102_parse_mode_string(Context *c, char *buf, int len);
extern void vt102_change_attr(VT102 *v, char *na);
extern void vt102_parse_attr_string(VT102 *v, char *buf, int len);
extern void vt102_save_state(VT102 *v);
@@ -48,12 +49,13 @@ extern void vt102_parse_csi(Context *c, char *buf, int len);
extern void vt102_parse_esc(Context *c);
extern void vt102_status_line(VT102 *v, char *str);
extern void vt102_parser_reset(VT102_parser *p);
-extern void vt102_reset_state(VT102 *v);
+extern void vt102_reset_state(Context *c);
extern void vt102_parse_char(Context *c, int ch);
extern void vt102_send(Context *c, uint8_t key);
-extern void vt102_reset(VT102 *v);
+extern void vt102_reset(Context *c);
extern VT102 *vt102_new(CRT_Pos *size);
extern void vt102_set_ansi(VT102 *v, int ansi);
+extern void vt102_resize(Context *c, CRT_Pos size);
extern void vt102_free(VT102 *v);
/* tty.c */
extern void tty_pre_select(TTY *t, fd_set *rfds, fd_set *wfds);
@@ -116,6 +118,8 @@ extern int ipc_msg_send_sendbreak(Socket *s);
extern int ipc_msg_send_setflow(Socket *s, int flow);
extern int ipc_msg_send_setansi(Socket *s, int ansi);
extern int ipc_msg_send_hangup(Socket *s);
+extern int ipc_msg_send_setsize(Socket *s, CRT_Pos size);
+extern int ipc_msg_send_reset(Socket *s);
/* slide.c */
extern void slide_free(Slide *s);
extern void slide_consume(Slide *s, int n);
diff --git a/src/vt102.c b/src/vt102.c
index 2132f83..f1e00e8 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.49 2008/02/28 11:27:48 james
+ * *** empty log message ***
+ *
* Revision 1.48 2008/02/27 09:42:53 james
* *** empty log message ***
*
@@ -394,6 +397,26 @@ in_margins (VT102 * v, CRT_Pos p)
return 1;
}
+void vt102_do_resize(Context *c)
+{
+
+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);
+
+ if (c->t)
+ tty_winch(c->t,v->current_size);
+}
+
+
void
vt102_log_line (Context * c, int line)
{
@@ -702,8 +725,9 @@ vt102_insert_into_line (VT102 * v, CRT_Pos p)
void
-vt102_change_mode (VT102 * v, int private, char *ns, int set)
+vt102_change_mode (Context *c, int private, char *ns, int set)
{
+ VT102 *v=c->v;
int m;
@@ -745,17 +769,7 @@ vt102_change_mode (VT102 * v, int private, char *ns, int set)
private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
VT102_COLS_80;
- 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);
-
-
+ vt102_do_resize(c);
break;
}
@@ -769,8 +783,9 @@ vt102_change_mode (VT102 * v, int private, char *ns, int set)
}
void
-vt102_parse_mode_string (VT102 * v, char *buf, int len)
+vt102_parse_mode_string (Context *c, char *buf, int len)
{
+ VT102 *v=c->v;
int private = 0;
char last = buf[len - 1];
char num[4];
@@ -795,7 +810,7 @@ vt102_parse_mode_string (VT102 * v, char *buf, int len)
{
if (*buf == ';')
{
- vt102_change_mode (v, private, &num[o], last == 'h');
+ vt102_change_mode (c, private, &num[o], last == 'h');
memset (num, 0, sizeof (num));
o = sizeof (num) - 1;
buf++;
@@ -812,7 +827,7 @@ vt102_parse_mode_string (VT102 * v, char *buf, int len)
buf++;
}
- vt102_change_mode (v, private, &num[o], last == 'h');
+ vt102_change_mode (c, private, &num[o], last == 'h');
}
@@ -1281,7 +1296,7 @@ vt102_parse_csi (Context * c, char *buf, int len)
break;
case 'h':
case 'l':
- vt102_parse_mode_string (v, &buf[1], len - 1);
+ vt102_parse_mode_string (c, &buf[1], len - 1);
break;
@@ -1477,9 +1492,7 @@ vt102_parse_esc (Context * c)
vt102_send_id (c, terminal_id);
break;
case 'c':
- vt102_reset (v);
-
-
+ vt102_reset (c);
break;
case '=':
v->application_keypad_mode = 1;
@@ -1589,8 +1602,9 @@ vt102_parser_reset (VT102_parser * p)
void
-vt102_reset_state (VT102 * v)
+vt102_reset_state (Context *c)
{
+ VT102 *v=c->v;
vt102_parser_reset (&v->parser);
v->attr = CRT_ATTR_NORMAL;
@@ -1599,14 +1613,8 @@ vt102_reset_state (VT102 * v)
v->application_keypad_mode = 0;
v->current_size = v->original_size;
- 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_do_resize(c);
memset (v->modes, 0, VT102_NMODES);
memset (v->private_modes, 0, VT102_NMODES);
@@ -1679,7 +1687,7 @@ vt102_parse_char (Context * c, int ch)
#endif
if (ch == SYM_CHAR_RESET)
{
- vt102_reset_state (v);
+ vt102_reset_state (c);
}
else if (p->in_cmd && !ctrl_chr (ch, p->cmd_termination))
{
@@ -2006,8 +2014,9 @@ vt102_send (Context * c, uint8_t key)
}
void
-vt102_reset (VT102 * v)
+vt102_reset (Context * c)
{
+ VT102 *v=c->v;
VT102_parser *p = &v->parser;
@@ -2031,7 +2040,7 @@ vt102_reset (VT102 * v)
v->current_line = v->pos;
vt102_parser_reset (p);
- vt102_reset_state (v);
+ vt102_reset_state (c);
vt102_save_state (v);
@@ -2069,8 +2078,6 @@ vt102_new (CRT_Pos * size)
v->original_size.y = VT102_ROWS;
}
- vt102_reset (v);
-
return v;
}
@@ -2080,6 +2087,24 @@ vt102_set_ansi (VT102 * v, int ansi)
v->xn_glitch = ansi ? 0 : 1;
}
+void vt102_resize(Context *c,CRT_Pos size)
+{
+
+
+ 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;
+
+ c->v->current_size=size;
+ vt102_do_resize(c);
+}
+
void
vt102_free (VT102 * v)
{
diff --git a/sympathy.1 b/sympathy.1
index 2ec7ea3..0fbbac2 100644
--- a/sympathy.1
+++ b/sympathy.1
@@ -336,6 +336,15 @@ disable RTS/CTS flow control
.B hangup
de-assert DTR for one second.
.TP 7
+.B width \fInn\fB
+set the current width of the screen to \fInn\fP, and reset the terminal emulator.
+.TP 7
+.B height \fInn\fB
+set the current height of the screen to \fInn\fP, and reset the terminal emulator.
+.TP 7
+.B reset
+reset the terminal emulator
+.TP 7
.B quit
exit this instance of sympathy (disconnect from the server if present)
.SH CHARACTER ENCODINGS
@@ -491,18 +500,18 @@ ANSI X3.64, ISO-6429, ECMA-48, ISO-2202, ISO-8859, ISO-10646, Digital Equipment
.SH BUGS
.PD
.IP \(bu 3
-the command line editor and parser should support better line editing and report failed commands
+The command editor and parser should support better line editing.
.IP \(bu 3
-when the \-\fBc\fP \-\fBs\fP major mode is used without the \-\fBk\fP option the pid
+It should be possible to change the escape character.
+.IP \(bu 3
+When the \-\fBc\fP \-\fBs\fP major mode is used without the \-\fBk\fP option the pid
used in the socket is that of the client process and therefore not unique.
.IP \(bu 3
-the HTML generated with the \-\fBH\fP option is ugly.
+The HTML generated with the \-\fBH\fP option is ugly.
.IP \(bu 3
-no useful error message is generated if opening the terminal device fails in the
+No useful error message is generated if opening the terminal device fails in the
\-\fBc\fP \-\fBs\fP major mode.
.IP \(bu 3
-no facility is made for rotation of the log files.
-.SH AUTHOR
-James McKenzie, james@fishsoup.dhs.org
+No facility is made for rotation of the log files.
.SH AUTHOR
James McKenzie, james@fishsoup.dhs.org