[PATCH] --tty switch for kbd

Zack Winkles winkie at linuxfromscratch.org
Sun Sep 28 10:55:45 PDT 2003


The description says it all.
-------------- next part --------------
Submitted By: Zack Winkles <winkie at linuxfromscratch.org>
Date: 2003-09-28
Initial Package Version: Kbd 1.08
Origin: RH kbd-1.08-10.src.rpm
Description: Creates the --tty flag for setfont, which allows those of
	us who want to use 2.6 kernels, setfont, and any sort of fb
	console. The ioctls changed in kernel 2.5.69, causing setfont
	to only change the font on the current tty. Those who set the
	console font at boot may want to set up a for loop setting the
	font on every console they have.

diff -Naur kbd-1.08.orig/src/setfont.c kbd-1.08/src/setfont.c
--- kbd-1.08.orig/src/setfont.c	2002-10-11 07:09:00.000000000 -0400
+++ kbd-1.08/src/setfont.c	2003-09-28 13:40:19.580188832 -0400
@@ -84,6 +84,7 @@
 "    setfont -{8|14|16} codepage.cp[.gz]   Load 8x<N> font from codepage.cp\n"
 "Explicitly (with -m or -u) or implicitly (in the fontfile) given mappings\n"
 "will be loaded and, in the case of consolemaps, activated.\n"
+"    --tty=device	Use `device' as console device for ioctls.\n"
 "    -h<N>      (no space) Override font height.\n"
 "    -m <fn>    Load console screen map.\n"
 "    -u <fn>    Load font unicode map.\n"
@@ -101,7 +102,7 @@
 int
 main(int argc, char *argv[]) {
 	char *ifiles[MAXIFILES];
-	char *mfil, *ufil, *Ofil, *ofil, *omfil, *oufil;
+	char *mfil, *ufil, *Ofil, *ofil, *omfil, *oufil, *tty;
 	int ifilct = 0, fd, i, iunit, hwunit, no_m, no_u;
 	int restore = 0;
 
@@ -111,9 +112,7 @@
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
 
-	fd = getfd();
-
-	ifiles[0] = mfil = ufil = Ofil = ofil = omfil = oufil = 0;
+	ifiles[0] = mfil = ufil = Ofil = ofil = omfil = oufil = tty = NULL;
 	iunit = hwunit = 0;
 	no_m = no_u = 0;
 
@@ -160,6 +159,8 @@
 		hwunit = atoi(argv[i]+2);
 		if (hwunit <= 0 || hwunit > 32)
 		  usage();
+	    } else if (!strncmp(argv[i], "--tty", 5)) {
+		tty = argv[i] + 6;
 	    } else if (argv[i][0] == '-') {
 		iunit = atoi(argv[i]+1);
 		if(iunit <= 0 || iunit > 32)
@@ -173,6 +174,15 @@
 	    }
 	}
 
+	if (tty) {
+	    if ((fd = open(tty, O_RDWR)) == -1) {
+		perror("open");
+		exit(EX_OSERR);
+	    }
+	} else {
+	    fd = getfd();
+	}
+
 	if (ifilct && restore) {
 	    fprintf(stderr, _("setfont: cannot both restore from character ROM"
 			      " and from file. Font unchanged.\n"));


More information about the patches mailing list