Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/stand/lib Don't treat timeouts or the return k...
details: https://anonhg.NetBSD.org/src/rev/8c837344333b
branches: trunk
changeset: 747415:8c837344333b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Sep 14 10:42:42 2009 +0000
description:
Don't treat timeouts or the return key as an invalid choice; spotted by
Andreas Gustafsson.
diffstat:
sys/arch/i386/stand/lib/bootmenu.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (38 lines):
diff -r ca8fea35caca -r 8c837344333b sys/arch/i386/stand/lib/bootmenu.c
--- a/sys/arch/i386/stand/lib/bootmenu.c Mon Sep 14 10:36:48 2009 +0000
+++ b/sys/arch/i386/stand/lib/bootmenu.c Mon Sep 14 10:42:42 2009 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index