summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-11-11 08:39:57 +0000
committered <ed@FreeBSD.org>2009-11-11 08:39:57 +0000
commitb9738de004ee6a85518ac03782f29e0e24e8200a (patch)
treeac9d89a27408d6aebabd29cad0f30389528083ff /usr.sbin
parentd551d6d2727cd8f942a1deb828424a69d1a99ff0 (diff)
downloadFreeBSD-src-b9738de004ee6a85518ac03782f29e0e24e8200a.zip
FreeBSD-src-b9738de004ee6a85518ac03782f29e0e24e8200a.tar.gz
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'.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.13
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c22
2 files changed, 22 insertions, 3 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.1 b/usr.sbin/vidcontrol/vidcontrol.1
index 2abaa1e..cb545ee 100644
--- a/usr.sbin/vidcontrol/vidcontrol.1
+++ b/usr.sbin/vidcontrol/vidcontrol.1
@@ -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
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index 847ff3e..06afe53 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -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;
OpenPOWER on IntegriCloud