Add an -S option that allows the user to disable vty switching. It is
implemented using a new VT_LOCKSWITCH ioctl. Although it is possible to implement something like this by VT_SETMODEing to VT_PROCESS and never releasing the vty, that method has a number of downsides, the biggest of which is that some program has to stay resident for the lock to be in effect. Reviewed by: roam, sheldonh
This commit is contained in:
parent
ce907d4246
commit
b471ed9e9d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99705
@ -13,7 +13,7 @@
|
||||
.\" @(#)vidcontrol.1
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 27, 2001
|
||||
.Dd May 27, 2002
|
||||
.Dt VIDCONTROL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -36,6 +36,7 @@
|
||||
.Op Fl M Ar char
|
||||
.Op Fl m Cm on | off
|
||||
.Op Fl r Ar foreground Ar background
|
||||
.Op Fl S Cm on | off
|
||||
.Op Fl s Ar number
|
||||
.Op Fl t Ar N | Cm off
|
||||
.Op Ar mode
|
||||
@ -213,6 +214,11 @@ Change reverse mode colors to
|
||||
.Ar foreground
|
||||
and
|
||||
.Ar background .
|
||||
.It Fl S Cm on | off
|
||||
Turn vty switching on or off.
|
||||
When vty switching is off,
|
||||
attempts to switch to a different virtual terminal will fail.
|
||||
(The default is to permit vty switching.)
|
||||
.It Fl s Ar number
|
||||
Set the current vty to
|
||||
.Ar number .
|
||||
|
@ -76,7 +76,7 @@ usage()
|
||||
"usage: vidcontrol [-CdLPpx] [-b color] [-c appearance] [-f [size] file]",
|
||||
" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
|
||||
" [-m on | off] [-M char] [-r foreground background] [-s num]",
|
||||
" [-t N | off] [mode] [foreground [background]] [show]");
|
||||
" [-S on | off] [-t N | off] [mode] [foreground [background]] [show]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -518,6 +518,23 @@ set_mouse(char *arg)
|
||||
ioctl(0, CONS_MOUSECTL, &mouse);
|
||||
}
|
||||
|
||||
void
|
||||
set_lockswitch(char *arg)
|
||||
{
|
||||
int data;
|
||||
|
||||
if (!strcmp(arg, "off"))
|
||||
data = 0x01;
|
||||
else if (!strcmp(arg, "on"))
|
||||
data = 0x02;
|
||||
else {
|
||||
warnx("argument to -S must either on or off");
|
||||
return;
|
||||
}
|
||||
if (ioctl(0, VT_LOCKSWITCH, &data) == -1)
|
||||
warn("ioctl(VT_LOCKSWITCH)");
|
||||
}
|
||||
|
||||
static char
|
||||
*adapter_name(int type)
|
||||
{
|
||||
@ -749,7 +766,7 @@ main(int argc, char **argv)
|
||||
/* Not reached */
|
||||
if (ioctl(0, CONS_GETINFO, &info) < 0)
|
||||
err(1, "must be on a virtual console");
|
||||
while((opt = getopt(argc, argv, "b:Cc:df:g:h:i:l:LM:m:pPr:s:t:x")) != -1)
|
||||
while((opt = getopt(argc, argv, "b:Cc:df:g:h:i:l:LM:m:pPr:S:s:t:x")) != -1)
|
||||
switch(opt) {
|
||||
case 'b':
|
||||
set_border_color(optarg);
|
||||
@ -806,6 +823,9 @@ main(int argc, char **argv)
|
||||
case 'r':
|
||||
set_reverse_colors(argc, argv, &optind);
|
||||
break;
|
||||
case 'S':
|
||||
set_lockswitch(optarg);
|
||||
break;
|
||||
case 's':
|
||||
set_console(optarg);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user