]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
pull-in block-arg again
authorBVK Chaitanya <bvk.groups@gmail.com>
Tue, 20 Jul 2010 22:20:23 +0000 (03:50 +0530)
committerBVK Chaitanya <bvk.groups@gmail.com>
Tue, 20 Jul 2010 22:20:23 +0000 (03:50 +0530)
1  2 
commands/extcmd.c
commands/menuentry.c
include/grub/script_sh.h
script/execute.c
script/parser.y
script/script.c

index 9dbb0a2ce7f8548a584400d97d2269806d6f4f46,cc0362e14bb7f77c846b8da1d1c57f3be5403a71..8fe2ead3578c97ba8eb7798eb5a29df9c14bebaf
@@@ -38,9 -38,11 +38,9 @@@ grub_extcmd_dispatcher (struct grub_com
  
    context.state = 0;
    context.extcmd = ext;
-   context.script_params = scripts;
+   context.script = script;
  
 -  /* Dynamic commands should not perform option parsing before
 -     corresponding module gets loaded.  */
 -  if (cmd->flags & GRUB_COMMAND_FLAG_DYNCMD)
 +  if (! ext->options)
      {
        ret = (ext->func) (&context, argc, args);
        return ret;
index 0ce5a9e0e1f065b2acb664e5654c9c50786bdb51,0000000000000000000000000000000000000000..2d389e9425d293c9733761023a4145e3a44c338f
mode 100644,000000..100644
--- /dev/null
@@@ -1,63 -1,0 +1,63 @@@
-   if (! argc || ! ctxt->script_params || ! ctxt->script_params[argc - 1])
 +/* menuentry.c - menuentry command */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2010  Free Software Foundation, Inc.
 + *
 + *  GRUB is free software: you can redistribute it and/or modify
 + *  it under the terms of the GNU General Public License as published by
 + *  the Free Software Foundation, either version 3 of the License, or
 + *  (at your option) any later version.
 + *
 + *  GRUB is distributed in the hope that it will be useful,
 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + *  GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
 +#include <grub/types.h>
 +#include <grub/misc.h>
 +#include <grub/err.h>
 +#include <grub/dl.h>
 +#include <grub/extcmd.h>
 +#include <grub/i18n.h>
 +#include <grub/normal.h>
 +
 +static grub_err_t
 +grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args)
 +{
 +  char *src;
 +  unsigned len;
 +  grub_err_t r;
 +
 +  /* XXX Rewrite to make use of already parsed menu definition.  */
++  if (! argc || ! ctxt->script)
 +    return GRUB_ERR_BAD_ARGUMENT;
 +
 +  src = args[argc - 1];
 +  args[argc - 1] = '\0';
 +  len = grub_strlen(src);
 +  src[len - 1] = '\0';
 +
 +  r = grub_normal_add_menu_entry (argc - 1, (const char **) args, src + 1);
 +
 +  src[len - 1] = '}';
 +  args[argc - 1] = src;
 +  return r;
 +}
 +
 +static grub_extcmd_t cmd;
 +
 +GRUB_MOD_INIT(menuentry)
 +{
 +  cmd = grub_register_extcmd ("menuentry", grub_cmd_menuentry,
 +                            GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_BLOCKS,
 +                            N_("BLOCK"), N_("Define a menuentry."), 0);
 +}
 +
 +GRUB_MOD_FINI(menuentry)
 +{
 +  grub_unregister_extcmd (cmd);
 +}
Simple merge
Simple merge
diff --cc script/parser.y
Simple merge
diff --cc script/script.c
Simple merge