All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yoshinori K. Okuji" <okuji@enbug.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: New commands (reboot, halt, help)
Date: Sat, 29 Jan 2005 02:23:09 +0100	[thread overview]
Message-ID: <200501290223.09666.okuji@enbug.org> (raw)
In-Reply-To: <87mzut3f3c.fsf@marco.marco-g.com>

On Friday 28 January 2005 13:36, Marco Gerards wrote:
> +static int
> +print_command_info (grub_command_t cmd)
> +{
> +  if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE
> +      || cmd->flags & GRUB_COMMAND_FLAG_BOTH)
> +    grub_printf ("%s\t\t%s\n", cmd->name, cmd->description);
> +  return 0;
> +}

Why do you test the flags with GRUB_COMMAND_FLAG_BOTH?

BTW, I prefer a two-column format like GRUB Legacy and BASH. Otherwise, 
it can emit too many lines.

> +static grub_err_t
> +grub_cmd_help (struct grub_arg_list *state __attribute__ ((unused)),
> +	       int argc __attribute__ ((unused)),
> +	       char **args __attribute__ ((unused)))
> +
> +{
> +  grub_printf ("All GRUB commands accept `--help'.\n\n");
> +
> +  grub_iterate_commands (print_command_info);
> +  return 0;
> +}

Please make it possible to specify arguments (e.g help ls).

> +  grub_register_command ("help", grub_cmd_help,
> GRUB_COMMAND_FLAG_BOTH, +			 "help", "Shows a help message", 0);
> +}

I think GRUB_COMMAND_FLAG_CMDLINE should be used for this command. I 
cannot think of any case where help is useful in the menu interface.

> EXPORT_FUNC(grub_register_command)
>  void EXPORT_FUNC(grub_unregister_command) (const char *name);
>  grub_command_t grub_command_find (char *cmdline);
>  grub_err_t grub_set_history (int newsize);
> -int grub_iterate_commands (int (*iterate) (grub_command_t));
> +int EXPORT_FUNC(grub_iterate_commands) (int (*iterate)
> (grub_command_t)); int grub_command_execute (char *cmdline);
>  void grub_command_init (void);
>  void grub_normal_init_page (void);

This is strange. You don't have to specify EXPORT_FUNC in normal.h, 
because the function is defined in a module but not in a kernel. 
EXPORT_* are required only by the kernel (because the kernel may not be 
an ELF object).

Okuji



  parent reply	other threads:[~2005-01-29  2:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28 12:36 New commands (reboot, halt, help) Marco Gerards
2005-01-28 12:52 ` chaac
2005-01-28 14:33   ` Marco Gerards
2005-01-28 18:54 ` Marco Gerards
2005-01-29  1:23 ` Yoshinori K. Okuji [this message]
2005-01-29 13:01   ` Marco Gerards
2005-01-29 14:30     ` Yoshinori K. Okuji
2005-01-29 15:11       ` Marco Gerards
2005-01-29 15:31         ` Serbinenko Vladimir
2005-01-29 16:17           ` Marco Gerards
2005-01-29 15:43         ` Marco Gerards
2005-01-29 17:47           ` Yoshinori K. Okuji
2005-01-29 17:45         ` Yoshinori K. Okuji
2005-01-29 18:36           ` Marco Gerards
2005-01-30 17:15 ` Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200501290223.09666.okuji@enbug.org \
    --to=okuji@enbug.org \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.