56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
/* test_blockarg.c - print and execute block argument */
|
|
/*
|
|
* VasEBoot -- GRand Unified Bootloader
|
|
* Copyright (C) 2010 Free Software Foundation, Inc.
|
|
*
|
|
* VasEBoot 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.
|
|
*
|
|
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <VasEBoot/dl.h>
|
|
#include <VasEBoot/err.h>
|
|
#include <VasEBoot/misc.h>
|
|
#include <VasEBoot/i18n.h>
|
|
#include <VasEBoot/extcmd.h>
|
|
#include <VasEBoot/script_sh.h>
|
|
|
|
VasEBoot_MOD_LICENSE ("GPLv3+");
|
|
|
|
static VasEBoot_err_t
|
|
test_blockarg (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
|
{
|
|
if (! ctxt->script)
|
|
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "no block parameter");
|
|
|
|
VasEBoot_printf ("%s\n", args[argc - 1]);
|
|
VasEBoot_script_execute (ctxt->script);
|
|
return VasEBoot_ERR_NONE;
|
|
}
|
|
|
|
static VasEBoot_extcmd_t cmd;
|
|
|
|
VasEBoot_MOD_INIT(test_blockarg)
|
|
{
|
|
cmd = VasEBoot_register_extcmd ("test_blockarg", test_blockarg,
|
|
VasEBoot_COMMAND_FLAG_BLOCKS,
|
|
N_("BLOCK"),
|
|
/* TRANSLATORS: this is the BLOCK-argument, not
|
|
environment block. */
|
|
N_("Print and execute block argument."), 0);
|
|
}
|
|
|
|
VasEBoot_MOD_FINI(test_blockarg)
|
|
{
|
|
VasEBoot_unregister_extcmd (cmd);
|
|
}
|