merged mainline
This commit is contained in:
commit
dd6fee39fa
208 changed files with 10984 additions and 2300 deletions
|
@ -46,6 +46,9 @@ grub_script_execute_cmd (struct grub_script_cmd *cmd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define ARG_ALLOCATION_UNIT (32 * sizeof (char))
|
||||
#define ARGV_ALLOCATION_UNIT (8 * sizeof (void*))
|
||||
|
||||
/* Expand arguments in ARGLIST into multiple arguments. */
|
||||
char **
|
||||
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count)
|
||||
|
@ -67,7 +70,7 @@ grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *c
|
|||
if (oom)
|
||||
return;
|
||||
|
||||
p = grub_realloc (argv, ALIGN_UP (sizeof(char*) * (argc + 1), 32));
|
||||
p = grub_realloc (argv, ALIGN_UP (sizeof(char*) * (argc + 1), ARGV_ALLOCATION_UNIT));
|
||||
if (!p)
|
||||
oom = 1;
|
||||
else
|
||||
|
@ -89,7 +92,7 @@ grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *c
|
|||
|
||||
len = nchar ?: grub_strlen (str);
|
||||
old = argv[argc - 1] ? grub_strlen (argv[argc - 1]) : 0;
|
||||
p = grub_realloc (argv[argc - 1], ALIGN_UP(old + len + 1, 32));
|
||||
p = grub_realloc (argv[argc - 1], ALIGN_UP(old + len + 1, ARG_ALLOCATION_UNIT));
|
||||
|
||||
if (p)
|
||||
{
|
||||
|
@ -199,6 +202,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grub_err_t ret = 0;
|
||||
int argcount = 0;
|
||||
grub_script_function_t func = 0;
|
||||
char errnobuf[18];
|
||||
char *cmdname;
|
||||
|
||||
/* Lookup the command. */
|
||||
|
@ -210,7 +214,6 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grubcmd = grub_command_find (cmdname);
|
||||
if (! grubcmd)
|
||||
{
|
||||
/* Ignore errors. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
/* It's not a GRUB command, try all functions. */
|
||||
|
@ -232,7 +235,13 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grub_env_set (assign, eq);
|
||||
}
|
||||
grub_free (assign);
|
||||
return grub_errno;
|
||||
|
||||
grub_snprintf (errnobuf, sizeof (errnobuf), "%d", grub_errno);
|
||||
grub_env_set ("?", errnobuf);
|
||||
|
||||
grub_print_error ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,6 +256,14 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
|
|||
grub_free (args[i]);
|
||||
grub_free (args);
|
||||
|
||||
if (grub_errno == GRUB_ERR_TEST_FAILURE)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
grub_print_error ();
|
||||
|
||||
grub_snprintf (errnobuf, sizeof (errnobuf), "%d", ret);
|
||||
grub_env_set ("?", errnobuf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ grub_script_lexer_record_stop (struct grub_parser_param *parser)
|
|||
while (*end && grub_isspace (*end)) end--;
|
||||
if (*end == '}') end--;
|
||||
while (*end && grub_isspace (*end)) end--;
|
||||
*end = '\0';
|
||||
end[1] = '\0';
|
||||
|
||||
return start;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
%token GRUB_PARSER_TOKEN_PIPE "|"
|
||||
%token GRUB_PARSER_TOKEN_AMP "&"
|
||||
%token GRUB_PARSER_TOKEN_SEMI ";"
|
||||
%token GRUB_PARSER_TOKEN_LPAR "("
|
||||
%token GRUB_PARSER_TOKEN_RPAR ")"
|
||||
%token GRUB_PARSER_TOKEN_LBR "{"
|
||||
%token GRUB_PARSER_TOKEN_RBR "}"
|
||||
%token GRUB_PARSER_TOKEN_NOT "!"
|
||||
|
|
|
@ -128,7 +128,7 @@ typedef grub_size_t yy_size_t;
|
|||
BLANK [ \t]
|
||||
COMMENT ^[ \t]*#.*$
|
||||
|
||||
CHAR [^|&$;()<> \t\n\'\"\\]
|
||||
CHAR [^|&$;<> \t\n\'\"\\]
|
||||
DIGITS [[:digit:]]+
|
||||
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
|
||||
|
||||
|
@ -157,8 +157,6 @@ WORD ({CHAR}|{DQSTR}|{SQSTR}|{ESC}|{VARIABLE})+
|
|||
"|" { RECORD; return GRUB_PARSER_TOKEN_PIPE; }
|
||||
"&" { RECORD; return GRUB_PARSER_TOKEN_AMP; }
|
||||
";" { RECORD; return GRUB_PARSER_TOKEN_SEMI; }
|
||||
"(" { RECORD; return GRUB_PARSER_TOKEN_LPAR; }
|
||||
")" { RECORD; return GRUB_PARSER_TOKEN_RPAR; }
|
||||
"<" { RECORD; return GRUB_PARSER_TOKEN_LT; }
|
||||
">" { RECORD; return GRUB_PARSER_TOKEN_GT; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue