Skip site navigation (1)Skip section navigation (2)
Date:      27 May 2001 14:58:13 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        arch@freebsd.org
Subject:   {kbd,vid}control insanity patch
Message-ID:  <xzpitinaqze.fsf@flood.ping.uio.no>

next in thread | raw e-mail | index | archive | help
--=-=-=

The attached patch moves the history buffer controls out of kbdcontrol
and into vidcontrol where they belong.  It also fixes some indentation
issues in {kbd,vid}control, removes the allscreens_kbdflags knob from
rc.syscons and rc.conf, and corrects some of the poor language in the
man pages.

(because of the indentation changes, the best way to view this patch
is to apply it, then 'cvs diff -b' the patched files)

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=vidcontrol.diff

Index: etc/rc.syscons
===================================================================
RCS file: /home/ncvs/src/etc/rc.syscons,v
retrieving revision 1.3
diff -u -r1.3 rc.syscons
--- etc/rc.syscons	2001/04/28 20:56:52	1.3
+++ etc/rc.syscons	2001/05/27 12:41:41
@@ -180,13 +180,4 @@
 	done
 fi
 
-# set this keyboard more for all virtual terminals
-#
-if [ -n "${allscreens_kbdflags}" ]; then
-	echo -n ' allscreens_kbd'
-	for ttyv in /dev/ttyv*; do
-		kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1
-	done
-fi
-
 echo '.'
Index: etc/defaults/rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.108
diff -u -r1.108 rc.conf
--- etc/defaults/rc.conf	2001/05/25 01:46:39	1.108
+++ etc/defaults/rc.conf	2001/05/27 12:41:57
@@ -299,8 +299,6 @@
 			# language code table, specify alternative range
 			# start like mousechar_start=3, see vidcontrol(1)
 allscreens_flags=""	# Set this vidcontrol mode for all virtual screens
-allscreens_kbdflags=""	# Set this kbdcontrol mode for all virtual screens
-
 
 ##############################################################
 ###  Miscellaneous administrative options  ###################
Index: usr.sbin/kbdcontrol/kbdcontrol.1
===================================================================
RCS file: /home/ncvs/src/usr.sbin/kbdcontrol/kbdcontrol.1,v
retrieving revision 1.29
diff -u -r1.29 kbdcontrol.1
--- usr.sbin/kbdcontrol/kbdcontrol.1	2001/05/27 00:47:38	1.29
+++ usr.sbin/kbdcontrol/kbdcontrol.1	2001/05/27 12:55:42
@@ -13,15 +13,15 @@
 .\"     @(#)kbdcontrol.1
 .\" $FreeBSD: src/usr.sbin/kbdcontrol/kbdcontrol.1,v 1.29 2001/05/27 00:47:38 dd Exp $
 .\"
-.Dd May 24, 2001
+.Dd May 27, 2001
 .Dt KBDCONTROL 1
 .Os
 .Sh NAME
 .Nm kbdcontrol
-.Nd a utility for manipulating the syscons console driver
+.Nd keyboard control and configuration utility
 .Sh SYNOPSIS
 .Nm
-.Op Fl cdFKix
+.Op Fl dFKix
 .Oo
 .Fl b
 .Ar duration . Ns Ar pitch | Ar belltype
@@ -32,7 +32,6 @@
 .Oc
 .Op Fl l Ar keymap_file
 .Op Fl f Ar # Ar string
-.Op Fl h Ar size
 .Op Fl k Ar keyboard_device
 .Op Fl L Ar keymap_file
 .Sh DESCRIPTION
@@ -97,8 +96,6 @@
 .Ar keymap_file .
 You may load the keyboard map file from a menu-driven command, 
 .Xr kbdmap 1 .
-.It Fl c
-Clear the history buffer.
 .It Fl d
 Dump the current keyboard map onto stdout.
 The output may be redirected to a file and can be loaded
@@ -117,10 +114,6 @@
 Set function keys back to the standard definitions.
 .It Fl x
 Use hexadecimal numbers in keyboard map dump.
-.It Fl h Ar size
-Set history buffer size to
-.Ar size
-lines.
 .It Fl i
 Print brief information about the keyboard.
 .It Fl K
Index: usr.sbin/kbdcontrol/kbdcontrol.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
retrieving revision 1.39
diff -u -r1.39 kbdcontrol.c
--- usr.sbin/kbdcontrol/kbdcontrol.c	2001/05/27 06:28:08	1.39
+++ usr.sbin/kbdcontrol/kbdcontrol.c	2001/05/27 12:37:10
@@ -965,33 +965,6 @@
 	}
 }
 
-
-void
-set_history(char *opt)
-{
-	int size;
-
-	size = atoi(opt);
-	if ((*opt == '\0') || size < 0) {
-		warnx("argument must be a positive number");
-		return;
-	}
-	if (ioctl(0, CONS_HISTORY, &size) == -1)
-		warn("setting history buffer size");
-}
-
-void
-clear_history()
-{
-
-#ifdef CONS_CLRHIST
-	if (ioctl(0, CONS_CLRHIST) == -1)
-		warn("clear history buffer");
-#else
-	warnx("clearing history not supported");
-#endif
-}
-
 static char
 *get_kbd_type_name(int type)
 {
@@ -1091,9 +1064,9 @@
 usage()
 {
 	fprintf(stderr, "%s\n%s\n%s\n",
-"usage: kbdcontrol [-cdFKix] [-b duration.pitch | [quiet.]belltype]",
+"usage: kbdcontrol [-dFKix] [-b duration.pitch | [quiet.]belltype]",
 "                  [-r delay.repeat | speed] [-l mapfile] [-f # string]",
-"                  [-h size] [-k device] [-L mapfile]");
+"                  [-k device] [-L mapfile]");
 	exit(1);
 }
 
@@ -1103,50 +1076,44 @@
 {
 	int		opt;
 
-	while((opt = getopt(argc, argv, "b:cdf:h:iKk:Fl:L:r:x")) != -1)
+	while((opt = getopt(argc, argv, "b:df:iKk:Fl:L:r:x")) != -1)
 		switch(opt) {
-			case 'b':
-				set_bell_values(optarg);
-				break;
-			case 'c':
-				clear_history();
-				break;
-			case 'd':
-				print_keymap();
-				break;
-			case 'l':
-				load_keymap(optarg, 0);
-				break;
-			case 'L':
-				load_keymap(optarg, 1);
-				break;
-			case 'f':
-				set_functionkey(optarg,
-					nextarg(argc, argv, &optind, 'f'));
-				break;
-			case 'F':
-				load_default_functionkeys();
-				break;
-			case 'h':
-				set_history(optarg);
-				break;
-			case 'i':
-				show_kbd_info();
-				break;
-			case 'K':
-				release_keyboard();
-				break;
-			case 'k':
-				set_keyboard(optarg);
-				break;
-			case 'r':
-				set_keyrates(optarg);
-				break;
-			case 'x':
-				hex = 1;
-				break;
-			default:
-				usage();
+		case 'b':
+			set_bell_values(optarg);
+			break;
+		case 'd':
+			print_keymap();
+			break;
+		case 'l':
+			load_keymap(optarg, 0);
+			break;
+		case 'L':
+			load_keymap(optarg, 1);
+			break;
+		case 'f':
+			set_functionkey(optarg,
+			    nextarg(argc, argv, &optind, 'f'));
+			break;
+		case 'F':
+			load_default_functionkeys();
+			break;
+		case 'i':
+			show_kbd_info();
+			break;
+		case 'K':
+			release_keyboard();
+			break;
+		case 'k':
+			set_keyboard(optarg);
+			break;
+		case 'r':
+			set_keyrates(optarg);
+			break;
+		case 'x':
+			hex = 1;
+			break;
+		default:
+			usage();
 		}
 	if ((optind != argc) || (argc == 1))
 		usage();
Index: usr.sbin/vidcontrol/vidcontrol.1
===================================================================
RCS file: /home/ncvs/src/usr.sbin/vidcontrol/vidcontrol.1,v
retrieving revision 1.37
diff -u -r1.37 vidcontrol.1
--- usr.sbin/vidcontrol/vidcontrol.1	2001/05/20 11:39:53	1.37
+++ usr.sbin/vidcontrol/vidcontrol.1	2001/05/27 12:55:50
@@ -13,34 +13,31 @@
 .\"     @(#)vidcontrol.1
 .\" $FreeBSD: src/usr.sbin/vidcontrol/vidcontrol.1,v 1.37 2001/05/20 11:39:53 ru Exp $
 .\"
-.Dd June 30, 1999
+.Dd May 27, 2001
 .Dt VIDCONTROL 1
 .Os
 .Sh NAME
 .Nm vidcontrol
-.Nd "a utility for manipulating the syscons console driver"
+.Nd system console control and configuration utility
 .Sh SYNOPSIS
 .Nm
+.Op Fl CdLPpx
 .Op Fl b Ar color
 .Op Fl c Ar appearance
-.Op Fl d
 .Oo
 .Fl f
 .Op Ar size
 .Ar file
 .Oc
 .Op Fl g Ar geometry
+.Op Fl h Ar size
 .Op Fl i Cm adapter | mode
 .Op Fl l Ar screen_map
-.Op Fl L
 .Op Fl M Ar char
 .Op Fl m Cm on | off
-.Op Fl p
-.Op Fl P
 .Op Fl r Ar foreground Ar background
 .Op Fl s Ar number
 .Op Fl t Ar N | Cm off
-.Op Fl x
 .Op Ar mode
 .Op Ar foreground Op Ar background
 .Op Cm show
@@ -110,13 +107,15 @@
 Set border color to 
 .Ar color .
 This option may not be always supported by the video driver.
+.It Fl C
+Clear the history buffer.
 .It Fl c Cm normal | blink | destructive
 Change the cursor appearance.
 The cursor is either an inverting block 
 .Pq Cm normal
-that eventually can 
-.Cm blink .
-Or it can be like the old hardware cursor
+that can optionally
+.Cm blink ,
+or it can be like the old hardware cursor
 .Pq Cm destructive .
 The latter is actually a simulation.
 .It Fl d
@@ -166,6 +165,10 @@
 and
 .Sx EXAMPLES
 below.
+.It Fl h Cm size
+Set the size of the history (scrollback) buffer to
+.Cm size
+lines.
 .It Fl i Cm adapter
 Shows info about the current video adapter.
 .It Fl i Cm mode
Index: usr.sbin/vidcontrol/vidcontrol.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/vidcontrol/vidcontrol.c,v
retrieving revision 1.38
diff -u -r1.38 vidcontrol.c
--- usr.sbin/vidcontrol/vidcontrol.c	2001/05/20 12:17:31	1.38
+++ usr.sbin/vidcontrol/vidcontrol.c	2001/05/27 12:51:58
@@ -73,10 +73,10 @@
 usage()
 {
 	fprintf(stderr, "%s\n%s\n%s\n%s\n",
-"usage: vidcontrol [-b color] [-c appearance] [-d] [-f [size] file] [-g geometry]",
-"                  [-i adapter | mode] [-l screen_map] [-L] [-m on | off]",
-"                  [-M char] [-p] [-P] [-r foreground background] [-s number]",
-"                  [-t N | off] [-x] [mode] [foreground [background]] [show]");
+"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]");
 	exit(1);
 }
 
@@ -714,6 +714,32 @@
 	return;
 }
 
+void
+set_history(char *opt)
+{
+	int size;
+
+	size = atoi(opt);
+	if ((*opt == '\0') || size < 0) {
+		warnx("argument must be a positive number");
+		return;
+	}
+	if (ioctl(0, CONS_HISTORY, &size) == -1)
+		warn("setting history buffer size");
+}
+
+void
+clear_history()
+{
+
+#ifdef CONS_CLRHIST
+	if (ioctl(0, CONS_CLRHIST) == -1)
+		warn("clear history buffer");
+#else
+	warnx("clearing history not supported");
+#endif
+}
+
 int
 main(int argc, char **argv)
 {
@@ -727,68 +753,74 @@
 		/* Not reached */
 	if (ioctl(0, CONS_GETINFO, &info) < 0)
 		err(1, "must be on a virtual console");
-	while((opt = getopt(argc, argv, "b:c:df:g: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:t:x")) != -1)
 		switch(opt) {
-			case 'b':
-				set_border_color(optarg);
-				break;
-			case 'c':
-				set_cursor_type(optarg);
-				break;
-			case 'd':
-				print_scrnmap();
-				break;
-			case 'f':
-				type = optarg;
-				font = nextarg(argc, argv, &optind, 'f', 0);
-				if (font == NULL) {
-					type = NULL;
-					font = optarg;
-				}
-				load_font(type, font);
-				break;
-			case 'g':
-				if (sscanf(optarg, "%dx%d", &vesa_cols,
-					   &vesa_rows) != 2) {
-					warnx("incorrect geometry: %s", optarg);
-					usage();
-				}
-				break;
-			case 'i':
-				show_info(optarg);
-				break;
-			case 'l':
-				load_scrnmap(optarg);
-				break;
-			case 'L':
-				load_default_scrnmap();
-				break;
-			case 'M':
-				set_mouse_char(optarg);
-				break;
-			case 'm':
-				set_mouse(optarg);
-				break;
-			case 'p':
-				dump_screen(DUMP_RAW);
-				break;
-			case 'P':
-				dump_screen(DUMP_TXT);
-				break;
-			case 'r':
-				set_reverse_colors(argc, argv, &optind);
-				break;
-			case 's':
-				set_console(optarg);
-				break;
-			case 't':
-				set_screensaver_timeout(optarg);
-				break;
-			case 'x':
-				hex = 1;
-				break;
-			default:
+		case 'b':
+			set_border_color(optarg);
+			break;
+		case 'C':
+			clear_history();
+			break;
+		case 'c':
+			set_cursor_type(optarg);
+			break;
+		case 'd':
+			print_scrnmap();
+			break;
+		case 'f':
+			type = optarg;
+			font = nextarg(argc, argv, &optind, 'f', 0);
+			if (font == NULL) {
+				type = NULL;
+				font = optarg;
+			}
+			load_font(type, font);
+			break;
+		case 'g':
+			if (sscanf(optarg, "%dx%d", &vesa_cols,
+			    &vesa_rows) != 2) {
+				warnx("incorrect geometry: %s", optarg);
 				usage();
+			}
+			break;
+		case 'h':
+			set_history(optarg);
+			break;
+		case 'i':
+			show_info(optarg);
+			break;
+		case 'l':
+			load_scrnmap(optarg);
+			break;
+		case 'L':
+			load_default_scrnmap();
+			break;
+		case 'M':
+			set_mouse_char(optarg);
+			break;
+		case 'm':
+			set_mouse(optarg);
+			break;
+		case 'p':
+			dump_screen(DUMP_RAW);
+			break;
+		case 'P':
+			dump_screen(DUMP_TXT);
+			break;
+		case 'r':
+			set_reverse_colors(argc, argv, &optind);
+			break;
+		case 's':
+			set_console(optarg);
+			break;
+		case 't':
+			set_screensaver_timeout(optarg);
+			break;
+		case 'x':
+			hex = 1;
+			break;
+		default:
+			usage();
 		}
 	video_mode(argc, argv, &optind);
 	set_normal_colors(argc, argv, &optind);

--=-=-=--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpitinaqze.fsf>