Module Name:    src
Committed By:   jmcneill
Date:           Mon Sep 14 10:42:43 UTC 2009

Modified Files:
        src/sys/arch/i386/stand/lib: bootmenu.c

Log Message:
Don't treat timeouts or the return key as an invalid choice; spotted by
Andreas Gustafsson.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/bootmenu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/lib/bootmenu.c
diff -u src/sys/arch/i386/stand/lib/bootmenu.c:1.7 src/sys/arch/i386/stand/lib/bootmenu.c:1.8
--- src/sys/arch/i386/stand/lib/bootmenu.c:1.7	Sun Sep 13 23:53:36 2009
+++ src/sys/arch/i386/stand/lib/bootmenu.c	Mon Sep 14 10:42:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootmenu.c,v 1.7 2009/09/13 23:53:36 jmcneill Exp $	*/
+/*	$NetBSD: bootmenu.c,v 1.8 2009/09/14 10:42:42 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -261,11 +261,15 @@
 static int
 getchoicefrominput(char *input, int def)
 {
-	int choice;
+	int choice, usedef;
+
 	choice = -1;
-	if (*input == '\0' || *input == '\r' || *input == '\n')
+	usedef = 0;
+
+	if (*input == '\0' || *input == '\r' || *input == '\n') {
 		choice = def;
-	else if (*input >= 'A' && *input < bootconf.nummenu + 'A')
+		usedef = 1;
+	} else if (*input >= 'A' && *input < bootconf.nummenu + 'A')
 		choice = (*input) - 'A';
 	else if (*input >= 'a' && *input < bootconf.nummenu + 'a')
 		choice = (*input) - 'a';
@@ -275,7 +279,8 @@
 			choice = -1;
 	}
 
-	if (bootconf.menuformat != MENUFORMAT_LETTER && !isnum(*input))
+	if (bootconf.menuformat != MENUFORMAT_LETTER &&
+	    !isnum(*input) && !usedef)
 		choice = -1;
 
 	return choice;

Reply via email to