From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MB8Lz-0000ma-11 for mharc-grub-devel@gnu.org; Mon, 01 Jun 2009 10:19:07 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MB8Lw-0000kN-Pu for grub-devel@gnu.org; Mon, 01 Jun 2009 10:19:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MB8Ls-0000hJ-Sf for grub-devel@gnu.org; Mon, 01 Jun 2009 10:19:04 -0400 Received: from [199.232.76.173] (port=42940 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MB8Ls-0000hD-P9 for grub-devel@gnu.org; Mon, 01 Jun 2009 10:19:00 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:63063) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MB8Ls-00010C-5V for grub-devel@gnu.org; Mon, 01 Jun 2009 10:19:00 -0400 Received: from [85.180.7.157] (e180007157.adsl.alicedsl.de [85.180.7.157]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MKuxg-1MB8Lm0hmF-000c2H; Mon, 01 Jun 2009 16:18:54 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: References: <1243426603.3425.2.camel@fz.local> Content-Type: multipart/mixed; boundary="=-gqNvKoo63FAy7+aMKb/0" Date: Mon, 01 Jun 2009 16:18:53 +0200 Message-Id: <1243865933.3417.2.camel@fz.local> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 X-Provags-ID: V01U2FsdGVkX18Ld+UashOSjL/7Mv7pHC3FvqVbwaAWofhFTfo RdpH00v4/65UgSAKCYaKaYC1+NdfwHWi/1rkeROUpw6dgyy0+H 5bPpoQzJB0WNBBiZ7Cdrw== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] add true and false commands 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: Mon, 01 Jun 2009 14:19:05 -0000 --=-gqNvKoo63FAy7+aMKb/0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Am Samstag, den 30.05.2009, 17:14 +0200 schrieb Vladimir 'phcoder' Serbinenko: > On Wed, May 27, 2009 at 2:16 PM, Felix Zielcke wrote: > > Hi, > > > > here's a simple patch which adds a `true' and a `false' command. > > `true' is actually needed by the compatibility code generated by > > grub-mkconfig for the terminal. > As far as I understand they are useful only in normal mode. Perhaps > putting them into normal.mod or sh.mod would make more sense? Ok here's a new patch which places them into normal.mod. Does a `false' command actually make sense in grub? -- Felix Zielcke --=-gqNvKoo63FAy7+aMKb/0 Content-Disposition: attachment; filename="true_false.patch.2" Content-Type: text/plain; name="true_false.patch.2"; charset="UTF-8" Content-Transfer-Encoding: 7bit 2009-06-01 Felix Zielcke * normal/main.c (grub_cmd_true): New function. (grub_mini_cmd_false): Likewise. (cmd_true): New static variable. (cmd_false): Likewise. (GRUB_MOD_INIT(minicmd)): Register commands true and false. (GRUB_MOD_FINI(minicmd)): Unregister commands true and false. diff --git a/normal/main.c b/normal/main.c index 9c5a827..c08f3b9 100644 --- a/normal/main.c +++ b/normal/main.c @@ -536,6 +536,26 @@ grub_env_write_pager (struct grub_env_var *var __attribute__ ((unused)), return grub_strdup (val); } +/* true */ +static grub_err_t +grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char *argv[] __attribute__ ((unused))) +{ + return 0; +} + +/* false */ +static grub_err_t +grub_cmd_false (struct grub_command *cmd __attribute__ ((unused)), + int argc __attribute__ ((unused)), + char *argv[] __attribute__ ((unused))) +{ + return 1; +} + +static grub_command_t cmd_true, cmd_false; + GRUB_MOD_INIT(normal) { /* Normal mode shouldn't be unloaded. */ @@ -561,6 +581,13 @@ GRUB_MOD_INIT(normal) /* Preserve hooks after context changes. */ grub_env_export ("color_normal"); grub_env_export ("color_highlight"); + + cmd_true = + grub_register_command ("true", grub_cmd_true, + 0, "do nothing, successfully"); + cmd_false = + grub_register_command ("false", grub_cmd_true, + 0, "do nothing, unsuccessfully"); } GRUB_MOD_FINI(normal) @@ -570,4 +597,6 @@ GRUB_MOD_FINI(normal) grub_register_variable_hook ("pager", 0, 0); grub_fs_autoload_hook = 0; free_handler_list (); + grub_unregister_command (cmd_true); + grub_unregister_command (cmd_false); } --=-gqNvKoo63FAy7+aMKb/0--