/* sleep.c - Command to wait a specified number of seconds. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* 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.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
GRUB_MOD_LICENSE ("GPLv3+");
{
{0, 0, 0, 0, 0, 0}
};
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);
}
/* Based on grub_millisleep() from kern/generic/millisleep.c. */
static int
{
start = grub_get_time_ms ();
return 1;
return 0;
}
static grub_err_t
{
int n;
if (argc != 1)
if (n == 0)
{
/* Either `0' or broken input. */
return 0;
}
pos = grub_term_save_pos ();
for (; n; n--)
{
do_print (n);
{
if (grub_interruptible_millisleep (1000))
return 1;
}
else
grub_millisleep (1000);
}
do_print (0);
return 0;
}
{
N_("NUMBER_OF_SECONDS"),
N_("Wait for a specified number of seconds."),
options);
}
{
}