#include <grub/extcmd.h>
#include <grub/i18n.h>
+GRUB_MOD_LICENSE ("GPLv3+");
+
static const struct grub_arg_option options[] =
{
{"verbose", 'v', 0, N_("Verbose countdown."), 0, 0},
- {"interruptible", 'i', 0, N_("Interruptible with ESC."), 0, 0},
+ {"interruptible", 'i', 0, N_("Allow to interrupt with ESC."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
-static grub_uint16_t *pos;
+static struct grub_term_coordinate *pos;
static void
do_print (int n)
/* NOTE: Do not remove the trailing space characters.
They are required to clear the line. */
grub_printf ("%d ", n);
+ grub_refresh ();
}
/* Based on grub_millisleep() from kern/generic/millisleep.c. */
start = grub_get_time_ms ();
while (grub_get_time_ms () - start < ms)
- if (grub_checkkey () >= 0 &&
- GRUB_TERM_ASCII_CHAR (grub_getkey ()) == GRUB_TERM_ESC)
+ if (grub_getkey_noblock () == GRUB_TERM_ESC)
return 1;
return 0;
}
static grub_err_t
-grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
+grub_cmd_sleep (grub_extcmd_context_t ctxt, int argc, char **args)
{
- struct grub_arg_list *state = cmd->state;
+ struct grub_arg_list *state = ctxt->state;
int n;
if (argc != 1)
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing operand");
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
n = grub_strtoul (args[0], 0, 10);
return 0;
}
+ grub_refresh ();
+
pos = grub_term_save_pos ();
for (; n; n--)
\f
GRUB_MOD_INIT(sleep)
{
- cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
+ cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, 0,
N_("NUMBER_OF_SECONDS"),
N_("Wait for a specified number of seconds."),
options);