svn commit: r316459 - head/usr.sbin/vidcontrol

Bruce Evans bde at FreeBSD.org
Mon Apr 3 13:06:29 UTC 2017


Author: bde
Date: Mon Apr  3 13:06:28 2017
New Revision: 316459
URL: https://svnweb.freebsd.org/changeset/base/316459

Log:
  Show high (blinking foreground/bright background) background colors.  Format
  output and source better for this.  Format output for 40 columns if there
  are less than 80 columns.

Modified:
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c	Mon Apr  3 13:04:36 2017	(r316458)
+++ head/usr.sbin/vidcontrol/vidcontrol.c	Mon Apr  3 13:06:28 2017	(r316459)
@@ -1167,6 +1167,7 @@ static void
 test_frame(void)
 {
 	vid_info_t info;
+	char *bg, *sep;
 	int i, fore;
 
 	info.size = sizeof(info);
@@ -1174,15 +1175,25 @@ test_frame(void)
 		err(1, "getting console information");
 
 	fore = 15;
+	if (info.mv_csz < 80) {
+		bg = "BG";
+		sep = " ";
+	} else {
+		bg = "BACKGROUND";
+		sep = "    ";
+	}
 
 	fprintf(stdout, "\033[=0G\n\n");
 	for (i=0; i<8; i++) {
-		fprintf(stdout, "\033[=%dF\033[=0G        %2d \033[=%dF%-16s"
-				"\033[=%dF\033[=0G        %2d \033[=%dF%-16s        "
-				"\033[=%dF %2d \033[=%dGBACKGROUND\033[=0G\n",
-			fore, i, i, legal_colors[i],
-			fore, i+8, i+8, legal_colors[i+8],
-			fore, i, i);
+		fprintf(stdout,
+		    "\033[=%dF\033[=0G%2d \033[=%dF%-7s%s"
+		    "\033[=%dF\033[=0G%2d \033[=%dF%-12s%s"
+		    "\033[=%dF%2d \033[=%dG%s\033[=0G%s"
+		    "\033[=%dF%2d \033[=%dG%s\033[=0G\n",
+		    fore, i, i, legal_colors[i], sep,
+		    fore, i + 8, i + 8, legal_colors[i + 8], sep,
+		    fore, i, i, bg, sep,
+		    fore, i + 8, i + 8, bg);
 	}
 	fprintf(stdout, "\033[=%dF\033[=%dG\033[=%dH\033[=%dI\n",
 		info.mv_norm.fore, info.mv_norm.back,


More information about the svn-src-all mailing list