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: Mon, 01 Jun 2009 16:18:53 +0200 [thread overview]
Message-ID: <1243865933.3417.2.camel@fz.local> (raw)
In-Reply-To: <d7ead6de0905300814l74dda76bwdabe2373df567b8a@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
Am Samstag, den 30.05.2009, 17:14 +0200 schrieb Vladimir 'phcoder'
Serbinenko:
> On Wed, May 27, 2009 at 2:16 PM, Felix Zielcke <fzielcke@z-51.de> 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
[-- Attachment #2: true_false.patch.2 --]
[-- Type: text/plain, Size: 1723 bytes --]
2009-06-01 Felix Zielcke <fzielcke@z-51.de>
* 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);
}
next prev parent reply other threads:[~2009-06-01 14:19 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 [this message]
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=1243865933.3417.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.