Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2016 13:09:21 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294321 - head/usr.sbin/vidcontrol
Message-ID:  <201601191309.u0JD9LR9091251@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Jan 19 13:09:20 2016
New Revision: 294321
URL: https://svnweb.freebsd.org/changeset/base/294321

Log:
  Add "vidcontrol -i active", to print out active vty number,
  to be used with eg "vidcontrol -s".
  
  Reviewed by:	emaste@
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D4968

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

Modified: head/usr.sbin/vidcontrol/vidcontrol.1
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.1	Tue Jan 19 12:38:53 2016	(r294320)
+++ head/usr.sbin/vidcontrol/vidcontrol.1	Tue Jan 19 13:09:20 2016	(r294321)
@@ -13,7 +13,7 @@
 .\"     @(#)vidcontrol.1
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2006
+.Dd January 19, 2016
 .Dt VIDCONTROL 1
 .Os
 .Sh NAME
@@ -33,7 +33,7 @@
 .Oc
 .Op Fl g Ar geometry
 .Op Fl h Ar size
-.Op Fl i Cm adapter | mode
+.Op Fl i Cm active | adapter | mode
 .Op Fl l Ar screen_map
 .Op Fl M Ar char
 .Op Fl m Cm on | off
@@ -198,6 +198,8 @@ below.
 Set the size of the history (scrollback) buffer to
 .Ar size
 lines.
+.It Fl i Cm active
+Shows the active vty number.
 .It Fl i Cm adapter
 Shows info about the current video adapter.
 .It Fl i Cm mode
@@ -266,7 +268,7 @@ option.
 However, you probably should not compile the kernel debugger on a box which
 is supposed to be physically secure.
 .It Fl s Ar number
-Set the current vty to
+Set the active vty to
 .Ar number .
 .It Fl T Cm xterm | cons25
 Switch between xterm and cons25 style terminal emulation.

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c	Tue Jan 19 12:38:53 2016	(r294320)
+++ head/usr.sbin/vidcontrol/vidcontrol.c	Tue Jan 19 13:09:20 2016	(r294321)
@@ -198,7 +198,7 @@ usage(void)
 	if (vt4_mode)
 		fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
 "usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
-"                  [-g geometry] [-h size] [-i adapter | mode]",
+"                  [-g geometry] [-h size] [-i active | adapter | mode]",
 "                  [-M char] [-m on | off] [-r foreground background]",
 "                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
 "                  [mode] [foreground [background]] [show]");
@@ -1035,6 +1035,18 @@ static const char
 
 
 /*
+ * Show active VTY, ie current console number.
+ */
+
+static void
+show_active_info(void)
+{
+
+	printf("%d\n", cur_info.active_vty);
+}
+
+
+/*
  * Show graphics adapter information.
  */
 
@@ -1153,13 +1165,16 @@ show_mode_info(void)
 static void
 show_info(char *arg)
 {
-	if (!strcmp(arg, "adapter")) {
+
+	if (!strcmp(arg, "active")) {
+		show_active_info();
+	} else if (!strcmp(arg, "adapter")) {
 		show_adapter_info();
 	} else if (!strcmp(arg, "mode")) {
 		show_mode_info();
 	} else {
 		revert();
-		errx(1, "argument to -i must be either adapter or mode");
+		errx(1, "argument to -i must be active, adapter, or mode");
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601191309.u0JD9LR9091251>