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: [PATCH] add true and false commands
Date: Wed, 27 May 2009 14:16:43 +0200	[thread overview]
Message-ID: <1243426603.3425.2.camel@fz.local> (raw)

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

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.

--
Felix Zielcke

[-- Attachment #2: true_false.patch --]
[-- Type: text/x-patch, Size: 1815 bytes --]

2009-05-27  Felix Zielcke  <fzielcke@z-51.de>

	* commands/minicmd.c (grub_mini_cmd_true): New function.
	(grub_mini_cmd_false): Likewise.
	(cmd_true, cmd_false): New static variables.
	(GRUB_MOD_INIT(minicmd)): Register commands true and false.
	(GRUB_MOD_FINI(minicmd)): Unregister commands true and false.

Index: commands/minicmd.c
===================================================================
--- commands/minicmd.c	(revision 2237)
+++ commands/minicmd.c	(working copy)
@@ -336,8 +336,27 @@ grub_mini_cmd_exit (struct grub_command 
   return 0;
 }
 
+/* true */
+static grub_err_t
+grub_mini_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc __attribute__ ((unused)),
+		    char *argv[] __attribute__ ((unused)))
+{
+  return 0;
+}
+
+/* false */
+static grub_err_t
+grub_mini_cmd_false (struct grub_command *cmd __attribute__ ((unused)),
+		    int argc __attribute__ ((unused)),
+		    char *argv[] __attribute__ ((unused)))
+{
+  return 1;
+}
+
 static grub_command_t cmd_cat, cmd_help, cmd_root;
 static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
+static grub_command_t cmd_true, cmd_false;
 
 GRUB_MOD_INIT(minicmd)
 {
@@ -362,6 +381,12 @@ GRUB_MOD_INIT(minicmd)
   cmd_exit =
     grub_register_command ("exit", grub_mini_cmd_exit,
 			   0, "exit from GRUB");
+  cmd_true =
+    grub_register_command ("true", grub_mini_cmd_true,
+			   0, "do nothing, successfully");
+  cmd_false =
+    grub_register_command ("false", grub_mini_cmd_true,
+			   0, "do nothing, unsuccessfully");
 }
 
 GRUB_MOD_FINI(minicmd)
@@ -373,4 +398,6 @@ GRUB_MOD_FINI(minicmd)
   grub_unregister_command (cmd_rmmod);
   grub_unregister_command (cmd_lsmod);
   grub_unregister_command (cmd_exit);
+  grub_unregister_command (cmd_true);
+  grub_unregister_command (cmd_false);
 }

             reply	other threads:[~2009-05-27 12:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 12:16 Felix Zielcke [this message]
2009-05-30 15:14 ` [PATCH] add true and false commands 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
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=1243426603.3425.2.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.