2005-08-14 Yoshinori K. Okuji <okuji@enbug.org>

* normal/menu.c (run_menu_entry):

        * normal/command.c (grub_command_execute): If INTERACTIVE is
        false and GRUB_COMMAND_FLAG_NO_ECHO is not specified, print
        CMDLINE. Disable the pager if INTERACTIVE is true.
        All callers are changed.

        * normal/main.c (grub_normal_execute): Read command.lst and fs.lst
        before reading a config file.
        * normal/main.c (read_config_file): Even if a command is not
        found, register it if it is within an entry.

        * util/grub-emu.c: Include sys/types.h and unistd.h.
        (options): Added --hold.
        (struct arguments): Added a new member "hold".
        (parse_opt): If KEY is 'H', set ARGS->HOLD to ARG or -1 if ARG is
        missing.
        (main): Initialize ARGS.HOLD to zero. Wait until ARGS.HOLD is
        cleared by a debugger, if it is not zero.

        * include/grub/normal.h (grub_command_execute): Add an argument
        INTERACTIVE.
This commit is contained in:
okuji 2005-08-14 19:36:55 +00:00
parent e51f85ae35
commit 0a74e62fde
8 changed files with 98 additions and 67 deletions

View file

@ -182,7 +182,7 @@ grub_iterate_commands (int (*iterate) (grub_command_t))
}
int
grub_command_execute (char *cmdline)
grub_command_execute (char *cmdline, int interactive)
{
auto grub_err_t cmdline_get (char **s);
grub_err_t cmdline_get (char **s)
@ -210,7 +210,12 @@ grub_command_execute (char *cmdline)
of calling a function. */
if (num == 0 && grub_strchr (args[0], '='))
{
char *val = grub_strchr (args[0], '=');
char *val;
if (! interactive)
grub_printf ("%s\n", cmdline);
val = grub_strchr (args[0], '=');
val[0] = 0;
grub_env_set (args[0], val + 1);
val[0] = '=';
@ -221,8 +226,14 @@ grub_command_execute (char *cmdline)
if (! cmd)
return -1;
if (! (cmd->flags & GRUB_COMMAND_FLAG_NO_ECHO) && ! interactive)
grub_printf ("%s\n", cmdline);
/* Enable the pager if the environment pager is set to 1. */
pager = grub_env_get ("pager");
if (interactive)
pager = grub_env_get ("pager");
else
pager = 0;
if (pager && (! grub_strcmp (pager, "1")))
grub_set_more (1);