]> git.proxmox.com Git - grub2.git/commitdiff
merge with mainline
authorBVK Chaitanya <bvk@dbook>
Sat, 4 Sep 2010 05:26:23 +0000 (10:56 +0530)
committerBVK Chaitanya <bvk@dbook>
Sat, 4 Sep 2010 05:26:23 +0000 (10:56 +0530)
1  2 
Makefile.util.def
grub-core/script/argv.c
grub-core/script/execute.c
grub-core/script/lexer.c
grub-core/script/main.c
include/grub/script_sh.h

index 87c33c05ecdf23404fc36f1d33ddabd71b024812,6dfd9301d81c0c3bcd0f5ee7cacf715a41f8475d..45c2f9761c37855b47a2f3c2dcc8dbf06e00cbef
@@@ -496,12 -501,12 +501,18 @@@ script = 
    common = tests/grub_script_shift.in;
  };
  
+ script = {
+   testcase;
+   name = grub_script_blockarg;
+   common = tests/grub_script_blockarg.in;
+ };
 +script = {
 +  testcase;
 +  name = grub_script_setparams;
 +  common = tests/grub_script_setparams.in;
 +};
 +
  program = {
    testcase;
    name = example_unit_test;
index c642ea9c59594fa7d59eb1a153dccf78a77c6865,92449138bc25e04f47fa3853784b5334e6b3a8b0..911989d0b8abef5e3afb4f607548a0fc676db7da
@@@ -55,25 -56,9 +56,26 @@@ grub_script_argv_free (struct grub_scri
  
    argv->argc = 0;
    argv->args = 0;
+   argv->script = 0;
  }
  
-   struct grub_script_argv r = { 0, 0};
 +/* Make argv from argc, args pair.  */
 +int
 +grub_script_argv_make (struct grub_script_argv *argv, int argc, char **args)
 +{
 +  int i;
++  struct grub_script_argv r = { 0, 0, 0 };
 +
 +  for (i = 0; i < argc; i++)
 +    if (grub_script_argv_next (&r) || grub_script_argv_append (&r, args[i]))
 +      {
 +      grub_script_argv_free (&r);
 +      return 1;
 +      }
 +  *argv = r;
 +  return 0;
 +}
 +
  /* Prepare for next argc.  */
  int
  grub_script_argv_next (struct grub_script_argv *argv)
index b911163f7bd67f4f38e1b0b828f5eaea89dffbdb,743b315ebe6682ea6f7a6062c2839ba349d6b91f..8e3c97434756f2fcea56a9c2772ee9862f2b996c
@@@ -113,35 -91,6 +114,35 @@@ grub_script_shift (grub_command_t cmd _
    return GRUB_ERR_NONE;
  }
  
-   struct grub_script_argv argv = { 0, 0 };
 +grub_err_t
 +grub_script_setparams (grub_command_t cmd __attribute__((unused)),
 +                     int argc, char **args)
 +{
 +  struct grub_script_scope *new_scope;
++  struct grub_script_argv argv = { 0, 0, 0 };
 +
 +  if (! scope)
 +    return GRUB_ERR_INVALID_COMMAND;
 +
 +  new_scope = grub_malloc (sizeof (*new_scope));
 +  if (! new_scope)
 +    return grub_errno;
 +
 +  if (grub_script_argv_make (&argv, argc, args))
 +    {
 +      grub_free (new_scope);
 +      return grub_errno;
 +    }
 +
 +  new_scope->shifts = 0;
 +  new_scope->argv = argv;
 +  new_scope->flags = GRUB_SCRIPT_SCOPE_MALLOCED |
 +    GRUB_SCRIPT_SCOPE_ARGS_MALLOCED;
 +
 +  replace_scope (new_scope);
 +  return GRUB_ERR_NONE;
 +}
 +
  static int
  grub_env_special (const char *name)
  {
  static char **
  grub_script_env_get (const char *name, grub_script_arg_type_t type)
  {
-   struct grub_script_argv result = { 0, 0 };
 +  unsigned i;
+   struct grub_script_argv result = { 0, 0, 0 };
  
    if (grub_script_argv_next (&result))
      goto fail;
index 42a570348081544f196e1015aeae843a5e38c34f,3ab40049f6be35eb44c92410d99af99fbc248cd9..8d1623fb85052218d6ab0d61c40fc9c87506f72f
@@@ -207,9 -205,8 +205,6 @@@ struct grub_lexer_param 
  grub_script_lexer_init (struct grub_parser_param *parser, char *script,
                        grub_reader_getline_t getline)
  {
--  int len;
-   char *script2;
--  YY_BUFFER_STATE buffer;
    struct grub_lexer_param *lexerstate;
  
    lexerstate = grub_zalloc (sizeof (*lexerstate));
Simple merge
index e0ed5c005cc1bcad05f2b1409990ac9c11772c8f,7952fff9b006cf1aed85306fc9365c4f4762364d..b371e49f18080d5070897d88054574b10ed9e884
@@@ -226,8 -245,9 +245,10 @@@ struct grub_parser_para
  void grub_script_init (void);
  void grub_script_fini (void);
  
+ void grub_script_mem_free (struct grub_script_mem *mem);
  void grub_script_argv_free    (struct grub_script_argv *argv);
 +int grub_script_argv_make     (struct grub_script_argv *argv, int argc, char **args);
  int grub_script_argv_next     (struct grub_script_argv *argv);
  int grub_script_argv_append   (struct grub_script_argv *argv, const char *s);
  int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);