All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollis@penguinppc.org>
To: grub-devel@gnu.org
Subject: [patch] configfile
Date: Sun, 13 Feb 2005 09:18:51 -0600	[thread overview]
Message-ID: <20050213151851.GA4056@miracle> (raw)

While working on setting prefix correctly, I found it useful to have the
`configfile' command like GRUB Legacy.

I haven't tested on i386. I'm not sure about the `nested' parameter to
grub_normal_execute, but this code seems to be working fine.

2005-02-13  Hollis Blanchard  <hollis@penguinppc.org>

	* conf/i386-pc.rmk (pkgdata_MODULES): Add configfile.mod.
	* conf/powerpc-ieee1275.rmk (pkgdata_MODULES): Likewise.
	* commands/configfile.mod: New file.

Index: conf/i386-pc.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.25
diff -u -p -r1.25 i386-pc.rmk
--- conf/i386-pc.rmk	31 Jan 2005 21:40:25 -0000	1.25
+++ conf/i386-pc.rmk	13 Feb 2005 15:39:37 -0000
@@ -84,7 +84,8 @@ genmoddep_SOURCES = util/genmoddep.c
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
 	hfs.mod jfs.mod normal.mod hello.mod vga.mod font.mod _multiboot.mod ls.mod \
 	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod chain.mod multiboot.mod \
-	amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod
+	amiga.mod apple.mod pc.mod loopback.mod reboot.mod halt.mod help.mod \
+	configfile.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
Index: conf/powerpc-ieee1275.rmk
===================================================================
RCS file: /cvsroot/grub/grub2/conf/powerpc-ieee1275.rmk,v
retrieving revision 1.23
diff -u -p -r1.23 powerpc-ieee1275.rmk
--- conf/powerpc-ieee1275.rmk	31 Jan 2005 21:40:25 -0000	1.23
+++ conf/powerpc-ieee1275.rmk	13 Feb 2005 15:39:37 -0000
@@ -65,7 +65,8 @@ genmoddep_SOURCES = util/genmoddep.c
 pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
 	hfs.mod jfs.mod normal.mod hello.mod font.mod \
 	boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
-	pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod
+	pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod \
+	configfile.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
--- /dev/null	2004-12-18 12:15:49.000000000 -0600
+++ commands/configfile.c	2005-02-13 09:11:41.166390400 -0600
@@ -0,0 +1,69 @@
+/* configfile.c - command to manually load config file  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/normal.h>
+#include <grub/dl.h>
+#include <grub/arg.h>
+#include <grub/term.h>
+#include <grub/misc.h>
+
+static grub_err_t
+grub_cmd_configfile (struct grub_arg_list *state __attribute__ ((unused)),
+	      int argc, char **args)
+
+{
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+
+  grub_cls ();
+  grub_normal_execute (args[0], 1);
+
+  return 0;
+}
+
+\f
+#ifdef GRUB_UTIL
+void
+grub_configfile_init (void)
+{
+  grub_register_command ("configfile", grub_cmd_configfile,
+			 GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
+			 "Load config file", 0);
+}
+
+void
+grub_configfile_fini (void)
+{
+  grub_unregister_command ("configfile");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void)mod;			/* To stop warning. */
+  grub_register_command ("configfile", grub_cmd_configfile,
+			 GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
+			 "Load config file", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("configfile");
+}
+#endif /* ! GRUB_UTIL */



             reply	other threads:[~2005-02-13 15:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-13 15:18 Hollis Blanchard [this message]
2005-02-13 16:03 ` [patch] configfile Yoshinori K. Okuji
2005-02-13 17:53 ` Marco Gerards
2005-02-13 18:49   ` Yoshinori K. Okuji
2005-02-13 19:41     ` Marco Gerards
2005-02-13 20:36       ` Yoshinori K. Okuji
2005-02-14 19:20         ` Marco Gerards
2005-02-14 20:54           ` Yoshinori K. Okuji
2005-02-14 21:03             ` Yoshinori K. Okuji
2005-02-13 18:52   ` Hollis Blanchard

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=20050213151851.GA4056@miracle \
    --to=hollis@penguinppc.org \
    --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.