]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Not command (!) support to GRUB script.
authorbvk.groups@gmail.com <>
Wed, 8 Sep 2010 03:51:02 +0000 (09:21 +0530)
committerbvk.groups@gmail.com <>
Wed, 8 Sep 2010 03:51:02 +0000 (09:21 +0530)
* tests/grub_script_not.in: New test.
* Makefile.util.def: Rules for new test.

* grub-core/script/execute.c (grub_script_execute_cmdline): Handle
! command as a special case.
* grub-core/script/yylex.l (GRUB_PARSER_TOKEN_NOT): Removed.

1  2 
ChangeLog
grub-core/script/execute.c

diff --cc ChangeLog
index 279668975ef0b3e510771563a0092141f88f2e0c,279668975ef0b3e510771563a0092141f88f2e0c..73db891d4ec2d3bad4796130727ad6aa40f682be
+++ b/ChangeLog
@@@ -1,6 -1,6 +1,18 @@@
++2010-09-08  BVK Chaitanya  <bvk.groups@gmail.com>
++
++      Not command (!) support to GRUB script.
++
++      * tests/grub_script_not.in: New test.
++      * Makefile.util.def: Rules for new test.
++
++      * grub-core/script/execute.c (grub_script_execute_cmdline): Handle
++      ! command as a special case.
++      * grub-core/script/yylex.l (GRUB_PARSER_TOKEN_NOT): Removed.
++
  2010-09-07  BVK Chaitanya  <bvk.groups@gmail.com>
  
--      * grub-core/commands/wildcard.c (wildcard_expand): Fix wrong grub_free.
++      * grub-core/commands/wildcard.c (wildcard_expand): Fix wrong
++      grub_free.
  
  2010-09-07  BVK Chaitanya  <bvk.groups@gmail.com>
  
index a7baee96cfede8f75ed34cb705b595472a68a947,87dd6581ceb6c1876f2864e7197f5b734d58e07c..e24c4b1af0e5204eada5f973f2f6a04898a85328
@@@ -594,13 -613,25 +613,25 @@@ grub_script_execute_cmdline (struct gru
      {
        if ((grubcmd->flags & GRUB_COMMAND_FLAG_BLOCKS) &&
          (grubcmd->flags & GRUB_COMMAND_FLAG_EXTCMD))
-       ret = grub_extcmd_dispatcher (grubcmd, argv.argc - 1, argv.args + 1,
-                                     argv.script);
+       ret = grub_extcmd_dispatcher (grubcmd, argc, args, argv.script);
        else
-       ret = (grubcmd->func) (grubcmd, argv.argc - 1, argv.args + 1);
+       ret = (grubcmd->func) (grubcmd, argc, args);
      }
    else
-     ret = grub_script_function_call (func, argv.argc - 1, argv.args + 1);
+     ret = grub_script_function_call (func, argc, args);
+   if (invert)
+     {
+       if (ret == GRUB_ERR_TEST_FAILURE)
+       grub_errno = ret = GRUB_ERR_NONE;
+       else if (ret == GRUB_ERR_NONE)
+       ret = grub_error (GRUB_ERR_TEST_FAILURE, "false");
+       else
+       {
+         grub_print_error ();
 -        grub_errno = ret = GRUB_ERR_NONE;
++        ret = GRUB_ERR_NONE;
+       }
+     }
  
    /* Free arguments.  */
    grub_script_argv_free (&argv);