Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Cusn4-00007R-KS for mharc-grub-devel@gnu.org; Sat, 29 Jan 2005 08:37:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CuseT-0007HQ-5k for grub-devel@gnu.org; Sat, 29 Jan 2005 08:28:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CuseB-00079K-Qg for grub-devel@gnu.org; Sat, 29 Jan 2005 08:28:27 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cuse9-00072J-Js for grub-devel@gnu.org; Sat, 29 Jan 2005 08:28:17 -0500 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CusFg-0001Mc-Iw for grub-devel@gnu.org; Sat, 29 Jan 2005 08:03:00 -0500 Received: from vscan-cn.han.nl (venus.han.nl [145.74.65.6]) by mail-cn.han.nl (Postfix) with ESMTP id 39F46915C for ; Sat, 29 Jan 2005 14:01:48 +0100 (CET) Received: from mail-cn.han.nl ([145.74.66.11]) by vscan-cn.han.nl (venus.han.nl [145.74.65.6]) (amavisd-new, port 10024) with ESMTP id 19579-08 for ; Sat, 29 Jan 2005 14:01:47 +0100 (CET) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id 1623E9059 for ; Sat, 29 Jan 2005 14:01:47 +0100 (CET) Received: from marco.marco-g.com (mgerards.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id C33A4C045 for ; Sat, 29 Jan 2005 14:01:46 +0100 (CET) Mail-Copies-To: metgerards@student.han.nl To: The development of GRUB 2 References: <87mzut3f3c.fsf@marco.marco-g.com> <200501290223.09666.okuji@enbug.org> From: Marco Gerards Date: Sat, 29 Jan 2005 13:01:40 +0000 In-Reply-To: <200501290223.09666.okuji@enbug.org> (Yoshinori K. Okuji's message of "Sat, 29 Jan 2005 02:23:09 +0100") Message-ID: <87ekg4s823.fsf@marco.marco-g.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (2.2.0) at vscan-cn.han.nl 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 13:37:28 -0000 "Yoshinori K. Okuji" writes: > 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? Not all commands, for example `title', should be printed. > BTW, I prefer a two-column format like GRUB Legacy and BASH. Otherwise, > it can emit too many lines. This is a two column format. The output is, for example: boot Boot an operating system cat Show the contents of a file cmp Compare two files help Shows a help message insmod Insert a module. loopback Makes a device of a file ls List devices and files lsmod Show loaded modules. rescue Enter into the rescue mode. rmmod Remove a module. set Set an environment variable. terminal Select a terminal. unset Remove an environment variable. >> +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). Ok. >> + 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. Ok. >> 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). Ok. Perhaps I was confused because the other functions were exported. Thanks, Marco