while (1) {
if (menu->delay >= 0) {
/* Autoboot was not stopped */
- bootmenu_autoboot_loop(menu, &key, &esc);
+ key = bootmenu_autoboot_loop(menu, &esc);
} else {
/* Some key was pressed, so autoboot was stopped */
bootmenu_loop(menu, &key, &esc);
return 1;
}
-void bootmenu_autoboot_loop(struct bootmenu_data *menu,
- enum bootmenu_key *key, int *esc)
+enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int *esc)
{
+ enum bootmenu_key key = BKEY_NONE;
int i, c;
while (menu->delay > 0) {
switch (c) {
case '\e':
*esc = 1;
- *key = BKEY_NONE;
+ key = BKEY_NONE;
break;
case '\r':
- *key = BKEY_SELECT;
+ key = BKEY_SELECT;
break;
case 0x3: /* ^C */
- *key = BKEY_QUIT;
+ key = BKEY_QUIT;
break;
default:
- *key = BKEY_NONE;
+ key = BKEY_NONE;
break;
}
printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1);
if (menu->delay == 0)
- *key = BKEY_SELECT;
+ key = BKEY_SELECT;
+
+ return key;
}
void bootmenu_loop(struct bootmenu_data *menu,
* indicating that the current option should be chosen.
*
* @menu: Menu being processed
- * @key: Returns the code for the key the user pressed:
+ * @esc: Set to 1 if the escape key is pressed, otherwise not updated
+ * Returns: code for the key the user pressed:
* enter: KEY_SELECT
* Ctrl-C: KEY_QUIT
* anything else: KEY_NONE
- * @esc: Set to 1 if the escape key is pressed, otherwise not updated
*/
-void bootmenu_autoboot_loop(struct bootmenu_data *menu,
- enum bootmenu_key *key, int *esc);
+enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int *esc);
/**
* bootmenu_loop() - handle waiting for a keypress when autoboot is disabled