aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <>2008-02-04 01:32:39 +0000
committerjames <>2008-02-04 01:32:39 +0000
commite45109d0e28411913f65e5aa16911e19217d2312 (patch)
treefe95a5cc6b8927a907ea9856655e071ad18ddc78
parentba58c87c457aa20cfebcc69374736ee8e7e3c470 (diff)
downloadsympathy-e45109d0e28411913f65e5aa16911e19217d2312.tar.gz
sympathy-e45109d0e28411913f65e5aa16911e19217d2312.tar.bz2
sympathy-e45109d0e28411913f65e5aa16911e19217d2312.zip
*** empty log message ***
-rw-r--r--src/Makefile.am5
-rw-r--r--src/testtty.c76
-rw-r--r--src/vt102.c66
3 files changed, 118 insertions, 29 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b740cf3..1c63eaf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,9 @@
# $Id$
#
# $Log$
+# Revision 1.2 2008/02/04 01:32:39 james
+# *** empty log message ***
+#
# Revision 1.1 2008/02/03 16:20:24 james
# *** empty log message ***
#
@@ -17,7 +20,7 @@
INCLUDES =
-SRCS= libsympathy.c version.c
+SRCS= ansi.c crt.c html.c libsympathy.c render.c testtty.c version.c vt102.c
CPROTO=cproto
SYMPATHYSRCS=${SRCS}
diff --git a/src/testtty.c b/src/testtty.c
new file mode 100644
index 0000000..2cef3e0
--- /dev/null
+++ b/src/testtty.c
@@ -0,0 +1,76 @@
+/*
+ * testtty.c:
+ *
+ * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
+ * All rights reserved.
+ *
+ */
+
+static char rcsid[] = "$Id$";
+
+/*
+ * $Log$
+ * Revision 1.1 2008/02/04 01:32:39 james
+ * *** empty log message ***
+ *
+ */
+
+#include "project.h"
+
+static void default_termios(struct termios *termios)
+{
+
+memset(termios,0,sizeof(termios));
+
+termios->c_iflag=ICRNL|IXON;
+termios->c_oflag=OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
+termios->c_lflag=ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
+
+termios->c_cc[VINTR]=003;
+termios->c_cc[VQUIT]=034;
+termios->c_cc[VERASE]=0177;
+termios->c_cc[VKILL]=025;
+termios->c_cc[VEOF]=004;
+termios->c_cc[VEOL]=0;
+termios->c_cc[VEOL2]=0;
+termios->c_cc[VSTART]=021;
+termios->c_cc[VSTOP]=023;
+termios->c_cc[VSUSP]=032;
+termios->c_cc[VLNEXT]=026;
+termios->c_cc[VWERASE]=027;
+termios->c_cc[VREPRINT]=022;
+termios->c_cc[VDISCARD]=017;
+
+termios->c_cflag=CS8 | CREAD | CLOCAL;
+
+cfsetispeed(termios,B9600);
+cfsetospeed(termios,B9600);
+}
+
+
+int open_fd_to_bash(void) /*thump*/
+{
+pid_t child;
+int fd;
+struct winsize winsize={0};
+struct termios termios;
+
+default_termios(&termios);
+
+winsize.ws_row=CRT_ROWS;
+winsize.ws_col=CRT_COLS;
+
+child=forkpty(&fd,NULL,&termios,&winsize);
+
+switch (child)
+{
+case -1:/*boo hiss*/
+ return -1;
+case 0: /*waaah*/
+ setenv("TERM","vt102",1);
+ execl("/bin/sh","-",(char *) 0);
+ _exit(-1);
+}
+
+return fd;
+}
diff --git a/src/vt102.c b/src/vt102.c
index 80b636c..eb365da 100644
--- a/src/vt102.c
+++ b/src/vt102.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.2 2008/02/04 01:32:39 james
+ * *** empty log message ***
+ *
* Revision 1.1 2008/02/03 23:36:41 james
* *** empty log message ***
*
@@ -51,49 +54,54 @@ vt100+keypad|dec vt100 numeric keypad no fkeys:\
/*
so the parser needs to be able to at least do
+CTRL-G
CTRL-H
+CTRL-I
+CTRL-J
+CTRL-M
+CTRL-N
+CTRL-O
+
+ESC7
+ESC8
+ESCH
+ESCM
+ESC>
+
ESC[%dA
ESC[%dB
ESC[%dC
ESC[%dD
-ESC[?7l
-ESC[?7h
-CTRL-O
-CTRL-N
-CTRL-G
-ESC[1K
-ESC[J
-ESC[K
ESC[H
+ESC[%d;%dH
ESC[J
-ESC[%d;%dh
-CTRL-M
-ESC[%d;%dr
+ESC[K
+ESC[1K
+ESC[L
+ESC[M
+ESC[P
+
ESC[3g
-CTRL-J
-ESC(B
-ESC)0
-ESC[5m
+ESC[4h
+ESC[4l
+ESC[m
ESC[1m
-ESC[m CTRL-O
+ESC[4m
+ESC[5m
ESC[7m
-ESC8
-ESC>
+ESC[%d;%dr
+
+ESC(B
+ESC)0
+
ESC[?3l
ESC[?4l
ESC[?5l
ESC[?7h
+ESC[?7h
+ESC[?7l
ESC[?8h
-ESC7
-ESCM
-ESCH
-CTRL-I
-ESC[4m
-ESC[L
-ESC[P
-ESC[M
-ESC[4l
-ESC[4h
+
*/
@@ -222,12 +230,14 @@ vt102_parse_char (VT102 * v, int c)
/*HT*/ case 9:
break;
/*LF*/ case 10:
+ vt102_cursor_motion(v,0,1,0,1);
break;
/*VT*/ case 11:
break;
/*FF*/ case 12:
break;
/*CR*/ case 13:
+ v->pos.x=0;
break;
/*SO*/ case 14:
/*SI*/ case 15: