remove menuentry from GRUB script
This commit is contained in:
parent
db45b311cc
commit
9d0bd7407d
6 changed files with 2 additions and 102 deletions
|
@ -139,21 +139,6 @@ struct grub_script_cmdwhile
|
|||
int until;
|
||||
};
|
||||
|
||||
/* A menu entry generate statement. */
|
||||
struct grub_script_cmd_menuentry
|
||||
{
|
||||
struct grub_script_cmd cmd;
|
||||
|
||||
/* The arguments for this menu entry. */
|
||||
struct grub_script_arglist *arglist;
|
||||
|
||||
/* The sourcecode the entry will be generated from. */
|
||||
const char *sourcecode;
|
||||
|
||||
/* Options. XXX: Not used yet. */
|
||||
int options;
|
||||
};
|
||||
|
||||
/* State of the lexer as passed to the lexer. */
|
||||
struct grub_lexer_param
|
||||
{
|
||||
|
@ -263,12 +248,6 @@ grub_script_create_cmdwhile (struct grub_parser_param *state,
|
|||
struct grub_script_cmd *list,
|
||||
int is_an_until_loop);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||
struct grub_script_arglist *arglist,
|
||||
char *sourcecode,
|
||||
int options);
|
||||
|
||||
struct grub_script_cmd *
|
||||
grub_script_append_cmd (struct grub_parser_param *state,
|
||||
struct grub_script_cmd *list,
|
||||
|
@ -313,7 +292,6 @@ grub_err_t grub_script_execute_cmdlist (struct grub_script_cmd *cmd);
|
|||
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
|
||||
grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd);
|
||||
|
||||
/* Execute any GRUB pre-parsed command or script. */
|
||||
grub_err_t grub_script_execute (struct grub_script *script);
|
||||
|
|
|
@ -424,31 +424,6 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Execute the menu entry generate statement. */
|
||||
grub_err_t
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd)
|
||||
{
|
||||
struct grub_script_cmd_menuentry *cmd_menuentry;
|
||||
struct grub_script_argv argv = { 0, 0, 0 };
|
||||
|
||||
cmd_menuentry = (struct grub_script_cmd_menuentry *) cmd;
|
||||
|
||||
if (cmd_menuentry->arglist)
|
||||
{
|
||||
if (grub_script_arglist_to_argv (cmd_menuentry->arglist, &argv))
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_normal_add_menu_entry (argv.argc, (const char **) argv.args,
|
||||
cmd_menuentry->sourcecode);
|
||||
|
||||
grub_script_argv_free (&argv);
|
||||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Execute any GRUB pre-parsed command or script. */
|
||||
grub_err_t
|
||||
grub_script_execute (struct grub_script *script)
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
%token <arg> GRUB_PARSER_TOKEN_WHILE "while"
|
||||
%token <arg> GRUB_PARSER_TOKEN_TIME "time"
|
||||
%token <arg> GRUB_PARSER_TOKEN_FUNCTION "function"
|
||||
%token <arg> GRUB_PARSER_TOKEN_MENUENTRY "menuentry"
|
||||
%token <arg> GRUB_PARSER_TOKEN_NAME "name"
|
||||
%token <arg> GRUB_PARSER_TOKEN_WORD "word"
|
||||
|
||||
|
@ -81,7 +80,7 @@
|
|||
|
||||
%type <cmd> script_init script
|
||||
%type <cmd> grubcmd ifclause ifcmd forcmd whilecmd untilcmd
|
||||
%type <cmd> command commands1 menuentry statement
|
||||
%type <cmd> command commands1 statement
|
||||
|
||||
%pure-parser
|
||||
%lex-param { struct grub_parser_param *state };
|
||||
|
@ -127,8 +126,7 @@ word: GRUB_PARSER_TOKEN_NAME { $$ = grub_script_add_arglist (state, 0, $1); }
|
|||
|
||||
statement: command { $$ = $1; }
|
||||
| function { $$ = 0; }
|
||||
| menuentry { $$ = $1; }
|
||||
|
||||
;
|
||||
argument : "case" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "do" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "done" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
|
@ -144,7 +142,6 @@ argument : "case" { $$ = grub_script_add_arglist (state, 0, $1); }
|
|||
| "until" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "while" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "function" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| "menuentry" { $$ = grub_script_add_arglist (state, 0, $1); }
|
||||
| word { $$ = $1; }
|
||||
;
|
||||
|
||||
|
@ -263,25 +260,6 @@ function: "function" "name"
|
|||
}
|
||||
;
|
||||
|
||||
menuentry: "menuentry"
|
||||
{
|
||||
grub_script_lexer_ref (state->lexerstate);
|
||||
}
|
||||
arguments1
|
||||
{
|
||||
$<offset>$ = grub_script_lexer_record_start (state);
|
||||
}
|
||||
delimiters0 "{" commands1 delimiters1 "}"
|
||||
{
|
||||
char *def;
|
||||
def = grub_script_lexer_record_stop (state, $<offset>4);
|
||||
*grub_strrchr(def, '}') = '\0';
|
||||
|
||||
grub_script_lexer_deref (state->lexerstate);
|
||||
$$ = grub_script_create_cmdmenu (state, $3, def, 0);
|
||||
}
|
||||
;
|
||||
|
||||
ifcmd: "if"
|
||||
{
|
||||
grub_script_lexer_ref (state->lexerstate);
|
||||
|
|
|
@ -273,30 +273,6 @@ grub_script_create_cmdwhile (struct grub_parser_param *state,
|
|||
return (struct grub_script_cmd *) cmd;
|
||||
}
|
||||
|
||||
/* Create a command that adds a menu entry to the menu. Title is an
|
||||
argument that is parsed to generate a string that can be used as
|
||||
the title. The sourcecode for this entry is passed in SOURCECODE.
|
||||
The options for this entry are passed in OPTIONS. */
|
||||
struct grub_script_cmd *
|
||||
grub_script_create_cmdmenu (struct grub_parser_param *state,
|
||||
struct grub_script_arglist *arglist,
|
||||
char *sourcecode, int options)
|
||||
{
|
||||
struct grub_script_cmd_menuentry *cmd;
|
||||
|
||||
cmd = grub_script_malloc (state, sizeof (*cmd));
|
||||
if (!cmd)
|
||||
return 0;
|
||||
|
||||
cmd->cmd.exec = grub_script_execute_menuentry;
|
||||
cmd->cmd.next = 0;
|
||||
cmd->sourcecode = sourcecode;
|
||||
cmd->arglist = arglist;
|
||||
cmd->options = options;
|
||||
|
||||
return (struct grub_script_cmd *) cmd;
|
||||
}
|
||||
|
||||
/* Create a chain of commands. LAST contains the command that should
|
||||
be added at the end of LIST's list. If LIST is zero, a new list
|
||||
will be created. */
|
||||
|
|
|
@ -169,7 +169,6 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
|
|||
"until" { RECORD; return GRUB_PARSER_TOKEN_UNTIL; }
|
||||
"while" { RECORD; return GRUB_PARSER_TOKEN_WHILE; }
|
||||
"function" { RECORD; return GRUB_PARSER_TOKEN_FUNCTION; }
|
||||
"menuentry" { RECORD; return GRUB_PARSER_TOKEN_MENUENTRY; }
|
||||
|
||||
{NAME} { RECORD; return GRUB_PARSER_TOKEN_NAME; }
|
||||
{WORD} {
|
||||
|
|
|
@ -93,12 +93,6 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused
|
|||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_script_execute (struct grub_script *script)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue