All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] add true and false commands
Date: Wed, 03 Jun 2009 17:45:54 +0200	[thread overview]
Message-ID: <1244043954.3407.4.camel@fz.local> (raw)
In-Reply-To: <d7ead6de0906010724n30a2dcd3rb1b9c5d3553494e5@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

Am Montag, den 01.06.2009, 16:24 +0200 schrieb Vladimir 'phcoder'
Serbinenko:
> However convention for
> creating false is:
>   return grub_error (GRUB_ERR_TEST_FAILURE, "false");
> and not
>   return 1;

Ok changed it. If everyone is fine with placing this in normal/main.c, I
commit it.
-- 
Felix Zielcke

[-- Attachment #2: true_false.patch.3 --]
[-- Type: text/plain, Size: 1758 bytes --]

2009-06-03  Felix Zielcke  <fzielcke@z-51.de>

	* normal/main.c (grub_cmd_true): New function.
	(grub_cmd_false): Likewise.
	(cmd_true): New static variable.
	(cmd_false): Likewise.
	(GRUB_MOD_INIT(normal)): Register commands true and false.
	(GRUB_MOD_FINI(normal)): Unregister commands true and false.

diff --git a/normal/main.c b/normal/main.c
index 9c5a827..ac657d7 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 grub_error (GRUB_ERR_TEST_FAILURE, "false");
+}
+
+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);
 }

  reply	other threads:[~2009-06-03 15:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 12:16 [PATCH] add true and false commands Felix Zielcke
2009-05-30 15:14 ` Vladimir 'phcoder' Serbinenko
2009-06-01 14:18   ` Felix Zielcke
2009-06-01 14:24     ` Vladimir 'phcoder' Serbinenko
2009-06-03 15:45       ` Felix Zielcke [this message]
2009-06-04  8:21         ` Marco Gerards
2009-06-05  8:47           ` Felix Zielcke
2009-06-05 10:00             ` Marco Gerards
2009-06-05 10:32               ` Felix Zielcke
2009-06-05 12:26                 ` Marco Gerards
2009-06-05 13:04                   ` Felix Zielcke
2009-06-05 13:29                     ` Marco Gerards
2009-06-05 15:56                       ` Felix Zielcke
2009-06-08  7:32                     ` Felix Zielcke

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=1244043954.3407.4.camel@fz.local \
    --to=fzielcke@z-51.de \
    --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.