[syslinux] Menu system exit

ganapathy murali krishnan gmurali at cs.uchicago.edu
Fri May 21 11:38:06 PDT 2004


Here is the right way to do it.

---- BEGIN SNIP --
add_item("Exit this menu","Go back to main menu",OPT_EXITMENU,NULL,0)

curr = showmenus(MAIN)

if (curr)
{
   if (curr->action == OPT_RUN)
   {
       if (syslinux) runcommand(curr->data);
       else csprint(curr->data,0x07);
       return 1;
    }
    csprint("Error in programming!",0x07);
    return 2;
}
// Now curr=NULL, which means user hit Esc or selected ExitMenu
if (syslinux) runcommand("mainmenu.com");
else csprint("mainmenu.com",0x07);

--- END SNIP ---

- Murali

PS: You dont need the "OPT_EXIT" check inside the "if curr", since it 
will never happen. I will remove
OPT_EXIT in the next revision (will be replaced by OPT_EXITMENU).


Aaron McSorley wrote:

>I cant get this to work, it still exits to the boot prompt.
>Does it make a difference that I'm using pxelinux?
>
>Here is the end of mymenu.c:
>
>  add_item("Exit this menu","Go back to Main Menu",OPT_EXITMENU,"mainmenu.com",0);
>
>  curr = showmenus(MAIN);
>
>  if (curr)
>  {
>
>        if (curr->action == OPT_EXIT) runcommand(curr->data);
>        if (curr->action == OPT_RUN)
>        {
>            if (syslinux) runcommand(curr->data);
>            else csprint(curr->data,0x07);
>            return 1;
>        }
>        csprint("Error in programming!",0x07);
>  }
>  return 0;
>
>
>I can run mainmenu.com from the boot prompt so, I know that works.
>
>Thanks for your help
> -Aaron
>
>On Thu, 20 May 2004, ganapathy murali krishnan wrote:
>
>  
>
>>If you look at your mymenu.c, there is a line which goes like
>>
>>"if (curr->action ==OPT_EXIT) return 0"
>>
>>You could just replace it with
>>
>>if (curr->action == OPT_EXIT) runcommand(curr->data)
>>
>>where the curr->data has the name of .com file to execute.
>>
>>- Murali
>> 
>>Aaron McSorley wrote:
>>
>>    
>>
>>> I want to make a menu system consisting of multiple
>>>comboot menu files, how do tell the exit (ESC, Left Arrow) function
>>>to go to a menu file rather than the boot prompt.
>>>
>>>Thanks
>>>-Aaron
>>>
>>>
>>>      
>>>
>
>
>_______________________________________________
>SYSLINUX mailing list
>Submissions to SYSLINUX at zytor.com
>Unsubscribe or set options at:
>http://www.zytor.com/mailman/listinfo/syslinux
>Please do not send private replies to mailing list traffic.
>
>
>  
>





More information about the Syslinux mailing list