Skip to contentSkip to conversation

mconf : find_menu

DISCUSSION FabF 1 participant 1 message Jun 3, 2004

lore
Share & tools
lore

FabF

author
#0 lore raw

Hi,

I'd like to have some function able to find a menu struct with filename
& prompt in mconf.This one doesn't seem to give the best results.Someone could help ? (Roman ?).

I'm scanning internal list of menus, then next menu's list then parent
list ....

Regards,
FabF

struct menu* find_menu (const char *szfile, const char *szprompt, struct menu* currentmenu)
{

if (!strcmp(menu_get_prompt(currentmenu), szprompt)){
                return currentmenu;
        }else
        if(currentmenu->list){
                find_menu(szfile, szprompt, currentmenu->list);
          }else
                if(currentmenu->next){
                          find_menu(szfile, szprompt,currentmenu->next);
                }
                     else if

((currentmenu->parent)&&(currentmenu->parent->next)){
find_menu(szfile, szprompt,
currentmenu->parent->next);