git: 1bb77846adee - stable/12 - vidcontrol: disable p, P, and H when vt(4) is in use

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Wed, 20 Apr 2022 03:30:14 UTC
The branch stable/12 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=1bb77846adee4a44c38a7b5777749357b1b9ff20

commit 1bb77846adee4a44c38a7b5777749357b1b9ff20
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-04-06 23:39:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-04-20 00:31:29 +0000

    vidcontrol: disable p, P, and H when vt(4) is in use
    
    These options use the CONS_SCRSHOT ioctl to capture the contents of the
    current console, which is not yet supported by vt(4).  Disable the
    options when vt(4) is in use rather than emitting a possibly confusing
    error message.
    
    This change should be reverted if CONS_SCRSHOT is implemented for vt(4).
    
    PR:             263099
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit c71ae91f1976746b380a8aada8676d7ae084fdc5)
    (cherry picked from commit 1f4442f71fa33a8ef6d3da808e32872fb23a5700)
    (cherry picked from commit 4aa249b5f367c3fe0aec287bbf156131ec75ebd3)
---
 usr.sbin/vidcontrol/vidcontrol.1 | 6 +++++-
 usr.sbin/vidcontrol/vidcontrol.c | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1
index 4a6497a6e819..9d35528accc5 100644
--- a/usr.sbin/vidcontrol/vidcontrol.1
+++ b/usr.sbin/vidcontrol/vidcontrol.1
@@ -13,7 +13,7 @@
 .\"     @(#)vidcontrol.1
 .\" $FreeBSD$
 .\"
-.Dd January 19, 2016
+.Dd April 6, 2022
 .Dt VIDCONTROL 1
 .Os
 .Sh NAME
@@ -382,12 +382,16 @@ For details about that
 format see
 .Sx Format of Video Buffer Dump
 below.
+Supported only with
+.Xr syscons 4 .
 .It Fl P
 Same as
 .Fl p ,
 but dump contents of the video buffer in a plain text format
 ignoring nonprintable characters and information about text
 attributes.
+Supported only with
+.Xr syscons 4 .
 .It Fl H
 When used with
 .Fl p
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index 67c0a9d3f8a5..848ef5401f31 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -196,7 +196,7 @@ usage(void)
 {
 	if (vt4_mode)
 		fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
-"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
+"usage: vidcontrol [-Cx] [-b color] [-c appearance] [-f [[size] file]]",
 "                  [-g geometry] [-h size] [-i active | adapter | mode]",
 "                  [-M char] [-m on | off]",
 "                  [-r foreground background] [-S on | off] [-s number]",
@@ -1410,7 +1410,7 @@ main(int argc, char **argv)
 	dumpopt = DUMP_FBF;
 	termmode = NULL;
 	if (vt4_mode)
-		opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
+		opts = "b:Cc:fg:h:i:M:m:r:S:s:T:t:x";
 	else
 		opts = "b:Cc:dfg:h:Hi:l:LM:m:pPr:S:s:T:t:x";