aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/vidcontrol/vidcontrol.c
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2014-10-23 12:38:05 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2014-10-23 12:38:05 +0000
commit069f1c256a26d81575c16469e2d4b2f38621f4ee (patch)
treed1ce370969ffeb054fd911ef56d203bea943c112 /usr.sbin/vidcontrol/vidcontrol.c
parent7c8e3a7f48b0d753b3d3aa9efdf4573a69daf1d5 (diff)
downloadsrc-069f1c256a26d81575c16469e2d4b2f38621f4ee.tar.gz
src-069f1c256a26d81575c16469e2d4b2f38621f4ee.zip
vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font
To restore the default font using vidcontrol(1), use the "-f" flag without an argument: vidcontrol -f < /dev/ttyv0 PR: 193910 Differential Revision: https://reviews.freebsd.org/D971 Submitted by: Marcin Cieslak <saper@saper.info> Reviewed by: ray@, emaste@ Approved by: ray@ MFC after: 1 week
Notes
Notes: svn path=/head/; revision=273544
Diffstat (limited to 'usr.sbin/vidcontrol/vidcontrol.c')
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c
index 32e4de64fbe6..3001f6998875 100644
--- a/usr.sbin/vidcontrol/vidcontrol.c
+++ b/usr.sbin/vidcontrol/vidcontrol.c
@@ -197,7 +197,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]",
+"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]",
" [-g geometry] [-h size] [-i adapter | mode]",
" [-M char] [-m on | off] [-r foreground background]",
" [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
@@ -409,6 +409,19 @@ load_vt4mappingtable(unsigned int nmappings, FILE *f)
return (t);
}
+/*
+ * Set the default vt font.
+ */
+
+static void
+load_default_vt4font(void)
+{
+ if (ioctl(0, PIO_VFONT_DEFAULT) == -1) {
+ revert();
+ errc(1, errno, "loading default vt font");
+ }
+}
+
static int
load_vt4font(FILE *f)
{
@@ -1328,7 +1341,7 @@ main(int argc, char **argv)
dumpopt = DUMP_FBF;
termmode = NULL;
if (vt4_mode)
- opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x";
+ opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x";
else
opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x";
@@ -1349,15 +1362,23 @@ main(int argc, char **argv)
print_scrnmap();
break;
case 'f':
- type = optarg;
- font = nextarg(argc, argv, &optind, 'f', 0);
+ optarg = nextarg(argc, argv, &optind, 'f', 0);
+ if (optarg != NULL) {
+ font = nextarg(argc, argv, &optind, 'f', 0);
- if (font == NULL) {
- type = NULL;
- font = optarg;
- }
+ if (font == NULL) {
+ type = NULL;
+ font = optarg;
+ } else
+ type = optarg;
- load_font(type, font);
+ load_font(type, font);
+ } else {
+ if (!vt4_mode)
+ usage(); /* Switch syscons to ROM? */
+
+ load_default_vt4font();
+ }
break;
case 'g':
if (sscanf(optarg, "%dx%d",