Module Name: src Committed By: bouyer Date: Sun Oct 18 16:41:28 UTC 2009
Modified Files: src/sys/arch/i386/stand/boot [netbsd-5]: boot2.c Log Message: Apply patch, requested by snj in ticket 1080: sys/arch/i386/stand/boot/boot2.c: patch - If the menuformat is not letter, do not allow letter keys to be aliases for number keys. - Don't treat timeouts or the return key as an invalid choice. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/i386/stand/boot/boot2.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/boot/boot2.c diff -u src/sys/arch/i386/stand/boot/boot2.c:1.38 src/sys/arch/i386/stand/boot/boot2.c:1.38.4.1 --- src/sys/arch/i386/stand/boot/boot2.c:1.38 Sat Oct 11 11:06:19 2008 +++ src/sys/arch/i386/stand/boot/boot2.c Sun Oct 18 16:41:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: boot2.c,v 1.38 2008/10/11 11:06:19 joerg Exp $ */ +/* $NetBSD: boot2.c,v 1.38.4.1 2009/10/18 16:41:28 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -482,11 +482,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'; @@ -495,6 +499,11 @@ if (choice < 0 || choice >= bootconf.nummenu) choice = -1; } + + if (bootconf.menuformat != MENUFORMAT_LETTER && + !isnum(*input) && !usedef) + choice = -1; + return choice; }