From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Cui0F-0004i3-Kv for mharc-grub-devel@gnu.org; Fri, 28 Jan 2005 21:06:23 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Cui0E-0004h4-98 for grub-devel@gnu.org; Fri, 28 Jan 2005 21:06:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Cuhui-0003go-AW for grub-devel@gnu.org; Fri, 28 Jan 2005 21:00:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cuhub-0003XP-Im for grub-devel@gnu.org; Fri, 28 Jan 2005 21:00:34 -0500 Received: from [212.43.237.68] (helo=kotoba.storever.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CuhJq-0005hi-GI for grub-devel@gnu.org; Fri, 28 Jan 2005 20:22:34 -0500 Received: from ASSP-nospam (localhost [127.0.0.1]) by kotoba.storever.com (Postfix) with ESMTP id B37E4F942E81 for ; Sat, 29 Jan 2005 02:22:33 +0100 (CET) Received: from 127.0.0.1 ([127.0.0.1] helo=localhost) by ASSP-nospam ; 29 Jan 05 01:22:33 -0000 From: "Yoshinori K. Okuji" Organization: enbug.org To: The development of GRUB 2 Date: Sat, 29 Jan 2005 02:23:09 +0100 User-Agent: KMail/1.7.1 References: <87mzut3f3c.fsf@marco.marco-g.com> In-Reply-To: <87mzut3f3c.fsf@marco.marco-g.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501290223.09666.okuji@enbug.org> Subject: Re: New commands (reboot, halt, help) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jan 2005 02:06:22 -0000 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