summaryrefslogtreecommitdiffstats
path: root/src/hci/tui
diff options
context:
space:
mode:
authorMichael Brown2012-04-29 00:18:55 +0200
committerMichael Brown2012-04-29 00:42:15 +0200
commit838a76a0426844e918d12ae0d2e2ee7622a0eca6 (patch)
tree075e79823a9deb2690c7312d2acae1f5b8043437 /src/hci/tui
parent[realtek] Support RTL8139 cards within generic Realtek driver (diff)
downloadipxe-838a76a0426844e918d12ae0d2e2ee7622a0eca6.tar.gz
ipxe-838a76a0426844e918d12ae0d2e2ee7622a0eca6.tar.xz
ipxe-838a76a0426844e918d12ae0d2e2ee7622a0eca6.zip
[menu] Add "--default" option to "choose" command
Suggested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/tui')
-rw-r--r--src/hci/tui/menu_ui.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index 2457a825..30d93ad2 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -303,7 +303,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
* @ret rc Return status code
*/
int show_menu ( struct menu *menu, unsigned int timeout_ms,
- struct menu_item **selected ) {
+ const char *select, struct menu_item **selected ) {
struct menu_item *item;
struct menu_ui ui;
int labelled_count = 0;
@@ -318,8 +318,13 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
if ( ! labelled_count )
ui.selected = ui.count;
labelled_count++;
- if ( item->is_default )
- ui.selected = ui.count;
+ if ( select ) {
+ if ( strcmp ( select, item->label ) == 0 )
+ ui.selected = ui.count;
+ } else {
+ if ( item->is_default )
+ ui.selected = ui.count;
+ }
}
ui.count++;
}