/* Returns the index of the first menuitem that starts with the key parameter.  */
static int menu_key_find_first(const menu_t *menu, const char *key)
/* Returns the index of the first menuitem that starts with the key parameter.  */
static int menu_key_find_first(const menu_t *menu, const char *key)
{
    int menuitem_found = MenuKeyFindNone;
    int menu_size = menu_get_size(menu);
    int index = 0;
    for (index = 0; index < menu_size; ++index)
    {
        if (menu->menuitems[index].key == NULL)
            continue;
        if (strncasecmp(key, menu->menuitems[index].key, strlen(key)) == 0)
        {
            menuitem_found = index;
            break;
        }
    }
    return menuitem_found;
}