aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjames <>2008-02-27 01:31:14 +0000
committerjames <>2008-02-27 01:31:14 +0000
commit4add819b42c292ee2a6fc4aeda782a447b1bcf27 (patch)
tree17b7f7ce7e45c6c6262db7cfeb548a4d6f1006e1 /src
parent74feb0db53bf6ed2d53ca59e3aed001f1160e62a (diff)
downloadsympathy-4add819b42c292ee2a6fc4aeda782a447b1bcf27.tar.gz
sympathy-4add819b42c292ee2a6fc4aeda782a447b1bcf27.tar.bz2
sympathy-4add819b42c292ee2a6fc4aeda782a447b1bcf27.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/log.c5
-rw-r--r--src/prototypes.h4
-rw-r--r--src/ptty.c7
-rw-r--r--src/utf8.c25
-rw-r--r--src/util.c17
-rw-r--r--src/vt102.c38
6 files changed, 63 insertions, 33 deletions
diff --git a/src/log.c b/src/log.c
index ef0dfb5..7c04f23 100644
--- a/src/log.c
+++ b/src/log.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
* Revision 1.4 2008/02/27 00:54:16 james
* *** empty log message ***
*
@@ -101,7 +104,7 @@ file_log_new (char *fn)
l->fp = f;
l->do_close = dc;
- fput_cp(f,0xffef);
+ fput_cp (f, 0xffef);
return (Log *) l;
}
diff --git a/src/prototypes.h b/src/prototypes.h
index a115592..dd7dfeb 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -51,7 +51,7 @@ extern void vt102_reset_state(VT102 *v);
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 VT102 *vt102_new(void);
+extern VT102 *vt102_new(int width);
extern void vt102_set_ansi(VT102 *v, int ansi);
extern void vt102_free(VT102 *v);
/* tty.c */
@@ -81,7 +81,7 @@ extern int ring_space(Ring *r);
extern int ring_bytes(Ring *r);
extern Ring *ring_new(int n);
/* ptty.c */
-extern TTY *ptty_open(char *path, char *argv[]);
+extern TTY *ptty_open(char *path, char *argv[], int width);
/* terminal.c */
extern int terminal_winches;
extern void terminal_atexit(void);
diff --git a/src/ptty.c b/src/ptty.c
index 98f1282..b8e77b1 100644
--- a/src/ptty.c
+++ b/src/ptty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.12 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
* Revision 1.11 2008/02/26 23:23:17 james
* *** empty log message ***
*
@@ -137,7 +140,7 @@ ptty_write (TTY * _t, void *buf, int len)
}
TTY *
-ptty_open (char *path, char *argv[])
+ptty_open (char *path, char *argv[],int width)
{
PTTY *t;
pid_t child;
@@ -150,7 +153,7 @@ ptty_open (char *path, char *argv[])
client_termios (&ctermios);
winsize.ws_row = VT102_ROWS;
- winsize.ws_col = VT102_COLS_80;
+ winsize.ws_col = width ? width:VT102_COLS_80;
child = forkpty (&fd, name, &ctermios, &winsize);
diff --git a/src/utf8.c b/src/utf8.c
index 7512c43..aaa5ffc 100644
--- a/src/utf8.c
+++ b/src/utf8.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/27 00:54:16 james
* *** empty log message ***
*
@@ -154,26 +157,27 @@ utf8_new (void)
}
-int utf8_encode (char *ptr, int ch)
+int
+utf8_encode (char *ptr, int ch)
{
if (ch < 0x80)
{
ptr[0] = ch;
- return 1;
+ return 1;
}
else if (ch < 0x800)
{
ptr[0] = 0xc0 | (ch >> 6);
ptr[1] = 0x80 | (ch & 0x3f);
- return 2;
+ return 2;
}
else if (ch < 0x10000)
{
ptr[0] = 0xe0 | (ch >> 12);
ptr[1] = 0x80 | ((ch >> 6) & 0x3f);
ptr[2] = 0x80 | (ch & 0x3f);
- return 3;
+ return 3;
}
else if (ch < 0x1fffff)
{
@@ -181,18 +185,19 @@ int utf8_encode (char *ptr, int ch)
ptr[1] = 0x80 | ((ch >> 12) & 0x3f);
ptr[2] = 0x80 | ((ch >> 6) & 0x3f);
ptr[3] = 0x80 | (ch & 0x3f);
- return 4;
+ return 4;
}
- return 0;
+ return 0;
}
void
utf8_emit (TTY * t, int ch)
{
uint8_t buf[4];
-int i;
- i=utf8_encode(buf,ch);
- if (!i) return;
+ int i;
+ i = utf8_encode (buf, ch);
+ if (!i)
+ return;
- t->xmit (t, buf, i);
+ t->xmit (t, buf, i);
}
diff --git a/src/util.c b/src/util.c
index ea46e77..91cb58b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.7 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
* Revision 1.6 2008/02/27 00:54:16 james
* *** empty log message ***
*
@@ -143,13 +146,15 @@ client_termios (struct termios *termios)
cfsetospeed (termios, B9600);
}
-int fput_cp(FILE *f,uint32_t ch)
+int
+fput_cp (FILE * f, uint32_t ch)
{
-char buf[4];
-int i;
-i=utf8_encode(buf,ch);
+ char buf[4];
+ int i;
+ i = utf8_encode (buf, ch);
-if (!i) return 0;
+ if (!i)
+ return 0;
-return fwrite(buf,i,1,f);
+ return fwrite (buf, i, 1, f);
}
diff --git a/src/vt102.c b/src/vt102.c
index 7c211c5..a879999 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.45 2008/02/27 01:31:14 james
+ * *** empty log message ***
+ *
* Revision 1.44 2008/02/27 00:54:16 james
* *** empty log message ***
*
@@ -387,7 +390,7 @@ vt102_log_line (Context * c, int line)
{
CRT_Pos e = { c->v->current_width - 1, line };
CRT_Pos p = { 0, line };
- char logbuf[4*(VT102_MAX_COLS + 1)],*logptr=logbuf;
+ char logbuf[4 * (VT102_MAX_COLS + 1)], *logptr = logbuf;
if (!c->l)
return;
@@ -404,9 +407,9 @@ vt102_log_line (Context * c, int line)
int ch = c->v->crt.screen[CRT_ADDR_POS (&p)].chr;
if (ch < 32)
ch = ' ';
- logptr+=utf8_encode(logptr,ch);
+ logptr += utf8_encode (logptr, ch);
}
- *logptr=0;
+ *logptr = 0;
c->l->log (c->l, logbuf);
}
@@ -996,12 +999,15 @@ vt102_regular_char (Context * c, VT102 * v, uint32_t ch)
if (ch < VT102_CHARSET_SIZE)
{
- int cs;
- if ((cs=vt102_charset_c0[ch])) {
- ch=cs;
- } else if ((cs=charset_from_csid[v->g[v->cs]][ch])) {
- ch=cs;
- }
+ int cs;
+ if ((cs = vt102_charset_c0[ch]))
+ {
+ ch = cs;
+ }
+ else if ((cs = charset_from_csid[v->g[v->cs]][ch]))
+ {
+ ch = cs;
+ }
}
v->crt.screen[CRT_ADDR_POS (&v->pos)].chr = ch;
v->crt.screen[CRT_ADDR_POS (&v->pos)].attr = v->attr;
@@ -1738,10 +1744,10 @@ vt102_parse_char (Context * c, int ch)
break;
#if 0
/*ACK*/ case 6:
- break;
+ break;
#endif
/*BEL*/ case 7:
- //FIXME beep
+ //FIXME beep
break;
/*BS*/ case 8:
vt102_cursor_retreat (c->v);
@@ -2016,7 +2022,7 @@ vt102_reset (VT102 * v)
}
VT102 *
-vt102_new (void)
+vt102_new (int width)
{
VT102 *v;
@@ -2026,6 +2032,14 @@ vt102_new (void)
vt102_reset (v);
+ if (width) {
+ v->current_width =width;
+ v->crt.width = v->current_width;
+ v->screen_end.x = v->current_width - 1;
+ v->top_margin = v->screen_start;
+ v->bottom_margin = v->screen_end;
+ vt102_cursor_home (v);
+ }
return v;
}