From: bvk.groups@gmail.com <> Date: Wed, 8 Sep 2010 03:51:02 +0000 (+0530) Subject: Not command (!) support to GRUB script. X-Git-Tag: 1.99~573 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=058e30ac09fac70445215292cac73a10a9e387cc;p=thirdparty%2Fgrub.git 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. --- 058e30ac09fac70445215292cac73a10a9e387cc diff --cc ChangeLog index 279668975,279668975..73db891d4 --- a/ChangeLog +++ b/ChangeLog @@@ -1,6 -1,6 +1,18 @@@ ++2010-09-08 BVK Chaitanya ++ ++ 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 -- * 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 diff --cc grub-core/script/execute.c index a7baee96c,87dd6581c..e24c4b1af --- a/grub-core/script/execute.c +++ b/grub-core/script/execute.c @@@ -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);