All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add true and false commands
@ 2009-05-27 12:16 Felix Zielcke
  2009-05-30 15:14 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 14+ messages in thread
From: Felix Zielcke @ 2009-05-27 12:16 UTC (permalink / raw)
  To: The development of GRUB 2

[-- 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);
 }

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-06-08  7:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.