[dev] [st][PATCH 2/4] Create a function for DEC test

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Mon, 28 Apr 2014 10:25:26 +0200

Almost of the sequences execute their action in a separate function,
which is good because helps to read the full set of sequences
faster.
---
 st.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/st.c b/st.c
index 0425c72..33e4277 100644
--- a/st.c
+++ b/st.c
_AT_@ -393,6 +393,7 @@ static void tsetmode(bool, bool, int *, int);
 static void tfulldirt(void);
 static void techo(char *, int);
 static bool tcontrolcode(uchar );
+static void tdectest(char );
 static int32_t tdefcolor(int *, int *, int);
 static void tselcs(void);
 static void tdeftran(char);
_AT_@ -2431,6 +2432,19 @@ tcontrolcode(uchar ascii) {
 }
 
 void
+tdectest(char c) {
+	static char E[UTF_SIZ] = "E";
+	int x, y;
+
+	if(c == '8') { /* DEC screen alignment test. */
+		for(x = 0; x < term.col; ++x) {
+			for(y = 0; y < term.row; ++y)
+				tsetchar(E, &term.c.attr, x, y);
+		}
+	}
+}
+
+void
 tputc(char *c, int len) {
 	uchar ascii;
 	bool control;
_AT_@ -2508,15 +2522,7 @@ tputc(char *c, int len) {
 			tdeftran(ascii);
 			tselcs();
 		} else if(term.esc & ESC_TEST) {
-			if(ascii == '8') { /* DEC screen alignment test. */
-				char E[UTF_SIZ] = "E";
-				int x, y;
-
-				for(x = 0; x < term.col; ++x) {
-					for(y = 0; y < term.row; ++y)
-						tsetchar(E, &term.c.attr, x, y);
-				}
-			}
+			tdectest(ascii);
 		} else {
 			switch(ascii) {
 			case '[':
-- 
1.8.5.3
Received on Mon Apr 28 2014 - 10:25:26 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 28 2014 - 10:36:10 CEST