undo changes to hello command

This commit is contained in:
BVK Chaitanya 2010-07-18 21:00:58 +05:30
parent f6e59c46e1
commit 93889c4717

View file

@ -26,29 +26,12 @@
#include <grub/extcmd.h>
#include <grub/i18n.h>
static struct grub_script *script;
static grub_err_t
grub_cmd_hello (grub_extcmd_context_t ctxt,
int argc, char **args __attribute__ ((unused)))
grub_cmd_hello (grub_extcmd_context_t ctxt __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
if (argc == 0 && script == 0)
grub_printf ("Hello World\n");
else if (argc == 0)
grub_script_execute (script);
else
{
if (! ctxt->script_params || ! ctxt->script_params[0])
return 1;
if (script)
grub_script_put (script);
script = grub_script_get (ctxt->script_params[0]);
}
grub_printf ("Hello World\n");
return 0;
}
@ -56,16 +39,11 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(hello)
{
cmd = grub_register_extcmd ("hello", grub_cmd_hello,
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_BLOCKS,
N_("[BLOCK]"), N_("Say \"Hello World\"."), 0);
cmd = grub_register_extcmd ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH,
0, N_("Say \"Hello World\"."), 0);
}
GRUB_MOD_FINI(hello)
{
if (script)
grub_script_put (script);
script = 0;
grub_unregister_extcmd (cmd);
}