Add a new flag to vidcontrol, -T, that allows terminal mode switching.

This will make it more easy for people to experiment with TERM=xterm.
Instead of echoing these strange escape sequences, I can just instruct
them to run `vidcontrol -T xterm'.
This commit is contained in:
Ed Schouten 2009-11-11 08:39:57 +00:00
parent f0c0b1430c
commit c8f1c81702
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=199174
2 changed files with 22 additions and 3 deletions

View File

@ -38,6 +38,7 @@
.Op Fl r Ar foreground Ar background
.Op Fl S Cm on | off
.Op Fl s Ar number
.Op Fl T Cm xterm | cons25
.Op Fl t Ar N | Cm off
.Op Ar mode
.Op Ar foreground Op Ar background
@ -243,6 +244,8 @@ is supposed to be physically secure.
.It Fl s Ar number
Set the current vty to
.Ar number .
.It Fl T Cm xterm | cons25
Switch between xterm and cons25 style terminal emulation.
.It Fl t Ar N | Cm off
Set the screensaver timeout to
.Ar N

View File

@ -185,8 +185,8 @@ usage(void)
"usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]",
" [-M char] [-m on | off] [-r foreground background]",
" [-S on | off] [-s number] [-t N | off] [mode]",
" [foreground [background]] [show]");
" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
" [mode] [foreground [background]] [show]");
exit(1);
}
@ -1159,6 +1159,18 @@ clear_history(void)
}
}
static void
set_terminal_mode(char *arg)
{
if (strcmp(arg, "xterm") == 0)
fprintf(stderr, "\033[=T");
else if (strcmp(arg, "cons25") == 0)
fprintf(stderr, "\033[=1T");
else
usage();
}
int
main(int argc, char **argv)
@ -1175,7 +1187,8 @@ main(int argc, char **argv)
err(1, "must be on a virtual console");
dumpmod = 0;
dumpopt = DUMP_FBF;
while((opt = getopt(argc, argv, "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:t:x")) != -1)
while ((opt = getopt(argc, argv,
"b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x")) != -1)
switch(opt) {
case 'b':
set_border_color(optarg);
@ -1244,6 +1257,9 @@ main(int argc, char **argv)
case 's':
set_console(optarg);
break;
case 'T':
set_terminal_mode(optarg);
break;
case 't':
set_screensaver_timeout(optarg);
break;