Date: Mon, 3 Apr 2017 13:06:28 +0000 (UTC) From: Bruce Evans <bde@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316459 - head/usr.sbin/vidcontrol Message-ID: <201704031306.v33D6Srw089619@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704031306.v33D6Srw089619>