Sfoglia il codice sorgente

Add DA and DECID sequences

These sequences are used by the host in order to can detect which kind of
terminal is connected. St will answer like a vt102 terminal with this patch.
---
 st.c |    9 +++++++++
 1 file changed, 9 insertions(+)
Roberto E. Vargas Caballero 12 anni fa
parent
commit
ffeeb678c5
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9 0
      st.c

+ 9 - 0
st.c

@@ -72,6 +72,8 @@
 #define X2COL(x) (((x) - BORDER)/xw.cw)
 #define X2COL(x) (((x) - BORDER)/xw.cw)
 #define Y2ROW(y) (((y) - BORDER)/xw.ch)
 #define Y2ROW(y) (((y) - BORDER)/xw.ch)
 
 
+#define VT102ID "\033[?6c"
+
 enum glyph_attribute {
 enum glyph_attribute {
 	ATTR_NULL      = 0,
 	ATTR_NULL      = 0,
 	ATTR_REVERSE   = 1,
 	ATTR_REVERSE   = 1,
@@ -1510,6 +1512,10 @@ csihandle(void) {
 		DEFAULT(csiescseq.arg[0], 1);
 		DEFAULT(csiescseq.arg[0], 1);
 		tmoveto(term.c.x, term.c.y+csiescseq.arg[0]);
 		tmoveto(term.c.x, term.c.y+csiescseq.arg[0]);
 		break;
 		break;
+	case 'c': /* DA -- Device Attributes */
+		if(csiescseq.arg[0] == 0)
+			ttywrite(VT102ID, sizeof(VT102ID));
+		break;
 	case 'C': /* CUF -- Cursor <n> Forward */
 	case 'C': /* CUF -- Cursor <n> Forward */
 	case 'a':
 	case 'a':
 		DEFAULT(csiescseq.arg[0], 1);
 		DEFAULT(csiescseq.arg[0], 1);
@@ -1933,6 +1939,9 @@ tputc(char *c, int len) {
 				}
 				}
 				term.esc = 0;
 				term.esc = 0;
 				break;
 				break;
+			case 'Z': /* DECID -- Identify Terminal */
+				ttywrite(VT102ID, sizeof(VT102ID));
+				break;
 			case 'c': /* RIS -- Reset to inital state */
 			case 'c': /* RIS -- Reset to inital state */
 				treset();
 				treset();
 				term.esc = 0;
 				term.esc = 0;