chiark / gitweb /
*** empty log message ***
authorjames <james>
Mon, 4 Feb 2008 01:32:39 +0000 (01:32 +0000)
committerjames <james>
Mon, 4 Feb 2008 01:32:39 +0000 (01:32 +0000)
src/Makefile.am
src/testtty.c [new file with mode: 0644]
src/vt102.c

index b740cf37b246db2c353f982f098eba84820eb9dc..1c63eaf234111c30e1526157f64c1bb1d0c44313 100644 (file)
@@ -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 (file)
index 0000000..2cef3e0
--- /dev/null
@@ -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;
+}
index 80b636c0570333a49d0784cf2334248079a49d9c..eb365daff45a856219f121eeede4642f8e60e63c 100644 (file)
@@ -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: