File mingetty-1.0.8s.dif of Package mingetty

--- Makefile
+++ Makefile	2010-07-23 12:29:12.038924788 +0000
@@ -5,7 +5,7 @@ DEFTERM	=	linux
 VERSION	=	mingetty-1.0.8s
 #
 DEFINES	=	-DRESET_TTY=1 -DDEFAULT_TERM=\"$(DEFTERM)\" -DVERSION=\"$(VERSION)\"
-CFLAGS	=	-Wall -O2 -pipe -D_GNU_SOURCE -D_BSD_SOURCE $(DEFINES)
+CFLAGS	=	-Wall $(RPM_OPT_FLAGS) -pipe -D_GNU_SOURCE -D_BSD_SOURCE $(DEFINES)
 #
 LDFLAGS	=	-Wl,-warn-common
 CC	=	gcc
--- mingetty.c
+++ mingetty.c	2011-03-14 12:56:51.479926014 +0000
@@ -466,6 +466,45 @@ static void do_prompt (int showlogin)
 		puts ("[press ENTER to login]");
 		getc (stdin);
 	}
+	if (showlogin) {
+		int kb = 0, nl = 0;
+		struct stat st;
+		if (stat("/var/run/numlock-on", &st) == 0)
+			nl = 1;
+		if (ioctl(0, KDGKBLED, &kb) == 0) {
+			char warn[128];
+			off_t len = 0;
+
+			if (nl && (kb & 0x02) == 0) {
+				strcpy(&warn[0], "Num Lock off");
+				len += 12;
+			} else if (nl == 0 && (kb & 2) && (kb & 0x20) == 0) {
+				strcpy(&warn[0], "Num Lock on");
+				len += 11;
+			}
+
+			if ((kb & 0x04) && (kb & 0x40) == 0) {
+				if (len) {
+					strcpy(&warn[len], ", ");
+					len += 2;
+				}
+				strcpy(&warn[len], "Caps Lock on");
+				len += 12;
+			}
+
+			if ((kb & 0x01) && (kb & 0x10) == 0) {
+				if (len) {
+					strcpy(&warn[len], ", ");
+					len += 2;
+				}
+				strcpy(&warn[len], "Scroll Lock on");
+				len += 14;
+			}
+
+			if (len)
+				printf ("Hint: %s\n\n", warn);
+		}
+	}
 	if (nohostname == 0)
 		printf ("%s ", hn);
 	if (showlogin)
@@ -694,14 +733,8 @@ int main (int argc, char **argv)
 		logname = autologin;
 		logoptstr = "-f \\u";
 	} else {
-		int oldkb = 0;
-		if (ioctl(0, KDGKBLED, &oldkb) == 0)
-			(void)ioctl(0, KDSKBLED, (oldkb | 2) & ~4);
-
 		while ((logname = get_logname ()) == 0)
 			/* do nothing */ ;
-
-		(void)ioctl(0, KDSKBLED, &oldkb);
 	}
 
 	strncpy (logcmd, loginprog, NAME_MAX);