/* test_blockarg.c - print and execute block argument */ /* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2010 Free Software Foundation, Inc. * * VAS_EBOOT 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. * * VAS_EBOOT 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 VAS_EBOOT. If not, see . */ #include #include #include #include #include #include VAS_EBOOT_MOD_LICENSE ("GPLv3+"); static VasEBoot_err_t test_blockarg (VasEBoot_extcmd_context_t ctxt, int argc, char **args) { if (! ctxt->script) return VasEBoot_error (VAS_EBOOT_ERR_BAD_ARGUMENT, "no block parameter"); VasEBoot_printf ("%s\n", args[argc - 1]); VasEBoot_script_execute (ctxt->script); return VAS_EBOOT_ERR_NONE; } static VasEBoot_extcmd_t cmd; VAS_EBOOT_MOD_INIT(test_blockarg) { cmd = VasEBoot_register_extcmd ("test_blockarg", test_blockarg, VAS_EBOOT_COMMAND_FLAG_BLOCKS, N_("BLOCK"), /* TRANSLATORS: this is the BLOCK-argument, not environment block. */ N_("Print and execute block argument."), 0); } VAS_EBOOT_MOD_FINI(test_blockarg) { VasEBoot_unregister_extcmd (cmd); }