[hackers] [st] Add DA and DECID sequences || "Roberto E. Vargas Caballero"

From: <hg_AT_suckless.org>
Date: Sat, 6 Oct 2012 21:22:36 +0200 (CEST)

changeset: 360:4e43cd608c09
tag: tip
user: "Roberto E. Vargas Caballero" <k0ga_AT_shike2.com>
date: Sat Oct 06 21:19:56 2012 +0200
files: st.c
description:
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(+)
diff -r e3b5512d7e4d -r 4e43cd608c09 st.c
--- a/st.c	Sat Oct 06 21:02:25 2012 +0200
+++ b/st.c	Sat Oct 06 21:19:56 2012 +0200
_AT_@ -72,6 +72,8 @@
 #define X2COL(x) (((x) - BORDER)/xw.cw)
 #define Y2ROW(y) (((y) - BORDER)/xw.ch)
 
+#define VT102ID "\033[?6c"
+
 enum glyph_attribute {
 	ATTR_NULL      = 0,
 	ATTR_REVERSE   = 1,
_AT_@ -1510,6 +1512,10 @@
 		DEFAULT(csiescseq.arg[0], 1);
 		tmoveto(term.c.x, term.c.y+csiescseq.arg[0]);
 		break;
+	case 'c': /* DA -- Device Attributes */
+		if(csiescseq.arg[0] == 0)
+			ttywrite(VT102ID, sizeof(VT102ID));
+		break;
 	case 'C': /* CUF -- Cursor <n> Forward */
 	case 'a':
 		DEFAULT(csiescseq.arg[0], 1);
_AT_@ -1933,6 +1939,9 @@
 				}
 				term.esc = 0;
 				break;
+			case 'Z': /* DECID -- Identify Terminal */
+				ttywrite(VT102ID, sizeof(VT102ID));
+				break;
 			case 'c': /* RIS -- Reset to inital state */
 				treset();
 				term.esc = 0;
Received on Sat Oct 06 2012 - 21:22:36 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 06 2012 - 21:24:05 CEST