From owner-svn-src-head@freebsd.org Tue Jan 19 13:09:22 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F52FA875DD; Tue, 19 Jan 2016 13:09:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 416CB19DB; Tue, 19 Jan 2016 13:09:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0JD9LB5091253; Tue, 19 Jan 2016 13:09:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0JD9LR9091251; Tue, 19 Jan 2016 13:09:21 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201601191309.u0JD9LR9091251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 19 Jan 2016 13:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294321 - head/usr.sbin/vidcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 13:09:22 -0000 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"); } }