/*
* $Log$
+ * Revision 1.14 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.13 2008/02/28 16:37:16 james
* *** empty log message ***
*
tty_hangup (c->t);
break;
case IPC_MSG_TYPE_SETSIZE:
- vt102_resize(c,m->setsize.winsize);
+ vt102_resize (c, m->setsize.winsize);
break;
case IPC_MSG_TYPE_RESET:
- vt102_reset(c);
+ vt102_reset (c);
break;
default:
fprintf (stderr, "Unhandeled message type %d\n", m->hdr.type);
/*
* $Log$
+ * Revision 1.20 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.19 2008/02/28 16:37:16 james
* *** empty log message ***
*
}
- vt102_reset(&c);
+ vt102_reset (&c);
if (server_socket)
/*
* $Log$
+ * Revision 1.23 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.22 2008/02/28 01:47:44 james
* *** empty log message ***
*
int c;
extern char *optarg;
extern int optind, opterr, optopt;
- CRT_Pos size = { VT102_COLS_80, VT102_ROWS };
+ CRT_Pos size = { VT102_COLS_80, VT102_ROWS_24 };
int oflags[128];
char *oargs[128];
sum += oflags['l'];
sum += oflags['v'];
- if (!sum) {
- /*If no mode is specified behave like screen */
- oflags['s']++;
- oflags['c']++;
- sum++;
- }
-
+ if (!sum)
+ {
+ /*If no mode is specified behave like screen */
+ oflags['s']++;
+ oflags['c']++;
+ sum++;
+ }
+
if (sum != 1)
fatal_moan
("specifiy exactly one of ( -c and or -s ), -t, -r, -l and -v");
fatal_moan ("cannot parse -r %s as an integer", oargs['r']);
oflags['k']++;
- if (safe_atoi(id)>0) {
- oargs['k'] = mome ("/.sympathy/%s%d", hostname, safe_atoi(id));
- } else {
- oargs['k'] = mome ("/.sympathy/%s", id);
- }
+ if (safe_atoi (id) > 0)
+ {
+ oargs['k'] = mome ("/.sympathy/%s%d", hostname, safe_atoi (id));
+ }
+ else
+ {
+ oargs['k'] = mome ("/.sympathy/%s", id);
+ }
oflags['r'] = 0;
oflags['c']++;
}
if ((size.x > VT102_MAX_COLS) || (size.x < 1))
fatal_moan ("-w requires a width between 1 and %d\n", VT102_MAX_COLS);
- if ((size.y > VT102_ROWS) || (size.y < 1))
+ if ((size.y > VT102_MAX_ROWS) || (size.y < 1))
fatal_moan ("-w requires a height between 1 and %d\n",
VT102_MAX_COLS);
}
else
{
- /*HACK-- check that console=device does not occur in */
- /*/proc/cmdline*/
- if (!oargs['d'])
- fatal_moan("no argument to -d");
-
- {
- char kernel_cmdline[4096]={0};
- char search_string[1024]="console=";
- char *ptr=oargs['d'];
- int fd;
-
- if (!strncmp("/dev/",ptr,5)) ptr+=5;
-
- strcat(search_string,ptr);
-
- fd=open("/proc/cmdline",O_RDONLY);
- read(fd,kernel_cmdline,sizeof(kernel_cmdline));
- close(fd);
-
- kernel_cmdline[sizeof(kernel_cmdline)-1]=0;
-
- if (strstr(kernel_cmdline,search_string))
- fatal_moan("/proc/cmdline contains %s",search_string);
- }
+ /*HACK-- check that console=device does not occur in */
+ /*/proc/cmdline */
+ if (!oargs['d'])
+ fatal_moan ("no argument to -d");
+
+ {
+ char kernel_cmdline[4096] = { 0 };
+ char search_string[1024] = "console=";
+ char *ptr = oargs['d'];
+ int fd;
+
+ if (!strncmp ("/dev/", ptr, 5))
+ ptr += 5;
+
+ strcat (search_string, ptr);
+
+ fd = open ("/proc/cmdline", O_RDONLY);
+ read (fd, kernel_cmdline, sizeof (kernel_cmdline));
+ close (fd);
+
+ kernel_cmdline[sizeof (kernel_cmdline) - 1] = 0;
+
+ if (strstr (kernel_cmdline, search_string))
+ fatal_moan ("/proc/cmdline contains %s", search_string);
+ }
tty =
serial_open (oargs['d'],
/*
* $Log$
+ * Revision 1.17 2008/02/28 16:57:51 james
+ * *** empty log message ***
+ *
* Revision 1.16 2008/02/27 18:29:49 james
* *** empty log message ***
*
" server, that are replayed on connexion\n"
" -u don't emit utf-8 try to use ISO-2202 to the local terminal\n"
" -w W[xH] start session with a screen of size W by H. 0<W<=132,\n"
- " 0<H<24, default 80 by 24\n"
- );
+ " 0<H<24, default 80 by 24\n");
exit (1);
/*
* $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 ***
+ *
* Revision 1.33 2008/02/27 09:42:21 james
* *** empty log message ***
*
}
static void
-ansi_resize_check (ANSI * a, CRT_Pos *size)
+ansi_resize_check (ANSI * a, CRT_Pos * size)
{
- if ((size && crt_pos_cmp(a->crt.size,*size))
+ if ((size && crt_pos_cmp (a->crt.size, *size))
|| crt_pos_cmp (a->terminal->size, a->size))
{
crt_reset (&a->crt);
if (size)
- a->crt.size =*size;
+ a->crt.size = *size;
// FIXME: -- echos back crap?
// a->terminal->xmit (a->terminal, "\033[c", 3);
{
char buf[32];
int i;
- int guess_scroll;
+ int guess_scroll;
/*Do we need to catch up on history?*/
if (a->history_ptr == h->wptr)
if ((a->size.x < a->crt.size.x) || (a->size.y < a->crt.size.y))
return;
- guess_scroll=a->crt.size.y-1; /*Bototm line should be a status line*/
+ guess_scroll = a->crt.size.y - 1; /*Bototm line should be a status line */
ansi_force_attr_normal (a);
static void
ansi_terminal_reset (ANSI * a)
{
- CRT_Pos p = { 0, a->crt.size.y};
+ CRT_Pos p = { 0, a->crt.size.y };
ansi_force_attr_normal (a);
ansi_move (a, p);
{
ansi_history (a, c->h);
ansi_draw (a, &c->v->crt);
+ tty_length(a->terminal,c->v->crt.size.y);
}
static void
/*
* $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 ***
*
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;
}
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);
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;
}
/*
* $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 ***
*
#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)
/*
* $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 ***
*
}
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);
}
/*
* $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 ***
*
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;
}
{
KeyDis_IPC *t = (KeyDis_IPC *) _t;
- vt102_reset(c);
+ vt102_reset (c);
ipc_msg_send_reset (t->s);
return 0;
}
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;
}
/* 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);
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[];
/*
* $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 ***
+ *
* Revision 1.14 2008/02/27 09:42:22 james
* *** empty log message ***
*
}
TTY *
-ptty_open (char *path, char *argv[], CRT_Pos *size)
+ptty_open (char *path, char *argv[], CRT_Pos * size)
{
PTTY *t;
pid_t child;
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);
/*
* $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 ***
*
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;
/*
* $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 ***
*
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
/*
* $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 ***
*
}
+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);
}
/*
* $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 ***
*
int rfd; \
int wfd; \
int hanging_up; \
- struct timeval hangup_clock;
+ struct timeval hangup_clock; \
+ int displayed_length;
#define TTY_BITFREQ_LEN 10
/*
* $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 ***
*
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 =
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);
}
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;
private_modes[VT102_PRIVATE_MODE_132COLS] ? VT102_COLS_132 :
VT102_COLS_80;
- vt102_do_resize(c);
+ vt102_do_resize (c);
break;
}
}
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];
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;
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);
#endif
}
- vt102_crt_update(c);
+ vt102_crt_update (c);
}
void
vt102_reset (Context * c)
{
- VT102 *v=c->v;
+ VT102 *v = c->v;
VT102_parser *p = &v->parser;
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;
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
/*
* $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 ***
*
#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
{
int in_escape;
int in_cmd;
-
+
int cmd_ptr;
int cmd_more_bytes;
int cmd_termination;
93f010bab6441e6f679f523725507d04 1.1.5
0baf4bcc06f0271dba444738df2ef1e3 1.1.6
30b3685c955c05efa7ba0affb9fbca1a 1.1.7
+b9ef98229248516850808e590721c0e5 1.1.8
88cd008326dcedb9dee8011ce2697e6a "February 27, 2008"
93f010bab6441e6f679f523725507d04 "February 28, 2008"
0baf4bcc06f0271dba444738df2ef1e3 "February 28, 2008"
+30b3685c955c05efa7ba0affb9fbca1a "February 28, 2008"
+b9ef98229248516850808e590721c0e5 "February 28, 2008"