File kbd-1.15.2-dumpkeys-C-opt.patch of Package kbd.10239

Index: docs/man/man1/dumpkeys.1.in
===================================================================
--- docs/man/man1/dumpkeys.1.in.orig
+++ docs/man/man1/dumpkeys.1.in
@@ -4,6 +4,7 @@
 dumpkeys \- dump keyboard translation tables
 .SH SYNOPSIS
 .B dumpkeys
+.RI [ \-C\ '<vc>' | \-\-console='<vc>' ]
 [
 .\".B \-1Vdfhiklnstv
 .B \-h \-\-help \-i \-\-short\-info \-l \-s \-\-long\-info
@@ -212,6 +213,12 @@ loadkeys how to interpret the keymap. (F
 .B \-V \-\-version
 Prints version number and exits.
 .LP
+The affected console device can be specified using the 
+.I -C 
+(or
+.I --console
+) option. This option supports exactly one device name.
+.LP
 .SH FILES
 .PD 0
 .TP 20
Index: src/dumpkeys.c
===================================================================
--- src/dumpkeys.c.orig
+++ src/dumpkeys.c
@@ -45,6 +45,8 @@ valid options are:\n\
 	-t --funcs-only	    display only the function key strings\n\
 	-k --keys-only	    display only key bindings\n\
 	-d --compose-only   display only compose key combinations\n\
+	-C <vc>\n\
+	   --console=<vc>   Indicate the virtual console device to be used.\n\
 	-c --charset="));
 	lk_list_charsets(stderr);
 	fprintf(stderr, _("\
@@ -60,7 +62,7 @@ valid options are:\n\
 
 int main(int argc, char *argv[])
 {
-	const char *short_opts          = "hilvsnf1tkdS:c:V";
+	const char *short_opts          = "hilvsnf1tkdS:C:c:V";
 	const struct option long_opts[] = {
 		{ "help", no_argument, NULL, 'h' },
 		{ "short-info", no_argument, NULL, 'i' },
@@ -73,6 +75,7 @@ int main(int argc, char *argv[])
 		{ "keys-only", no_argument, NULL, 'k' },
 		{ "compose-only", no_argument, NULL, 'd' },
 		{ "charset", required_argument, NULL, 'c' },
+		{ "console", required_argument, NULL, 'C' },
 		{ "verbose", no_argument, NULL, 'v' },
 		{ "version", no_argument, NULL, 'V' },
 		{ NULL, 0, NULL, 0 }
@@ -87,6 +90,7 @@ int main(int argc, char *argv[])
 	char funcs_only      = 0;
 	char keys_only       = 0;
 	char diac_only       = 0;
+        char * console = NULL;
 
 	struct lk_ctx *ctx;
 
@@ -143,6 +147,9 @@ int main(int argc, char *argv[])
 				}
 				printf("charset \"%s\"\n", optarg);
 				break;
+			case 'C':
+				console = optarg;
+				break;
 			case 'V':
 				print_version_and_exit();
 			case 'h':
@@ -154,7 +161,7 @@ int main(int argc, char *argv[])
 	if (optind < argc)
 		usage();
 
-	if ((fd = getfd(NULL)) < 0)
+	if ((fd = getfd(console)) < 0)
 		kbd_error(EXIT_FAILURE, 0, _("Couldn't get a file descriptor referring to the console"));
 
 	/* check whether the keyboard is in Unicode mode */
openSUSE Build Service is sponsored by