|
| 1 | +/* pause.c - Wait for a keystroke with or without custom messages */ |
| 2 | +/* |
| 3 | + * GRUB -- GRand Unified Bootloader |
| 4 | + * Copyright (C) 2006,2007,2010 Free Software Foundation, Inc. |
| 5 | + * |
| 6 | + * GRUB is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * GRUB is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with GRUB. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +#include <grub/dl.h> |
| 21 | +#include <grub/misc.h> |
| 22 | +#include <grub/extcmd.h> |
| 23 | +#include <grub/err.h> |
| 24 | +#include <grub/i18n.h> |
| 25 | +#include <grub/term.h> |
| 26 | + |
| 27 | +GRUB_MOD_LICENSE ("GPLv3+"); |
| 28 | + |
| 29 | +static grub_err_t |
| 30 | +grub_cmd_pause (grub_extcmd_context_t ctxt __attribute__ ((unused)), |
| 31 | + int argc, char **args) |
| 32 | +{ |
| 33 | + if (argc != 1) |
| 34 | + grub_printf ("%s", N_("Press any key to continue...")); |
| 35 | + else |
| 36 | + grub_printf ("%s", args[0]); |
| 37 | + |
| 38 | + (void) grub_getkey (); |
| 39 | + return GRUB_ERR_NONE; |
| 40 | +} |
| 41 | + |
| 42 | +static grub_extcmd_t cmd; |
| 43 | + |
| 44 | +GRUB_MOD_INIT(pause) |
| 45 | +{ |
| 46 | + cmd = grub_register_extcmd ("pause", grub_cmd_pause, 0, |
| 47 | + "STRING", N_("Wait for a key stroke with a message."), |
| 48 | + 0); |
| 49 | +} |
| 50 | + |
| 51 | +GRUB_MOD_FINI(pause) |
| 52 | +{ |
| 53 | + grub_unregister_extcmd (cmd); |
| 54 | +} |
0 commit comments