]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
hello module and bug fix of util/resolve.c
authorgniibe <gniibe@localhost>
Sat, 8 Feb 2003 08:15:43 +0000 (08:15 +0000)
committergniibe <gniibe@localhost>
Sat, 8 Feb 2003 08:15:43 +0000 (08:15 +0000)
ChangeLog
conf/i386-pc.rmk
hello/hello.c [new file with mode: 0644]
include/grub/normal.h
util/resolve.c

index 80b8ae35ea7133b3bb7dec41c015605eeb29c7db..6a461305e0cdbdefe11af375f6b802945cbc6ebd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-02-08  NIIBE Yutaka  <gniibe@m17n.org>
+
+       * util/resolve.c (pupa_util_resolve_dependencies): BUG
+       FIX. Reverse the path_list.
+
+       * include/pupa/normal.h: Export pupa_register_command and
+       pupa_unregister_command.
+
+       * hello/hello.c (pupa_cmd_hello): New module.
+       * conf/i386-pc.rmk: Added hello.mod.
+
 2003-01-31  Yoshinori K. Okuji  <okuji@enbug.org>
 
        * kern/i386/pc/lzo1x.S: New file.
index f8123ae46f3c8055b4bfe7d888a0d1178603a234..1d49d686e90f87d12003c3626e5765b5900ee046 100644 (file)
@@ -61,7 +61,7 @@ pupa_setup_SOURCES = util/i386/pc/pupa-setup.c util/i386/pc/biosdisk.c \
 genmoddep_SOURCES = util/genmoddep.c
 
 # Modules.
-pkgdata_MODULES = _chain.mod _linux.mod fat.mod normal.mod
+pkgdata_MODULES = _chain.mod _linux.mod fat.mod normal.mod hello.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -80,3 +80,7 @@ normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
        normal/menu.c normal/i386/setjmp.S
 normal_mod_CFLAGS = $(COMMON_CFLAGS)
 normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
diff --git a/hello/hello.c b/hello/hello.c
new file mode 100644 (file)
index 0000000..cfc0e63
--- /dev/null
@@ -0,0 +1,46 @@
+/* hello.c - test module for dynamic loading */
+/*
+ *  PUPA  --  Preliminary Universal Programming Architecture for GRUB
+ *  Copyright (C) 2003  NIIBE Yutaka <gniibe@m17n.org>
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <pupa/types.h>
+#include <pupa/misc.h>
+#include <pupa/mm.h>
+#include <pupa/err.h>
+#include <pupa/dl.h>
+#include <pupa/normal.h>
+
+static int
+pupa_cmd_hello (int argc, char *argv[])
+{
+  (void)argc;  (void)argv;     /* To stop warning. */
+  pupa_printf ("Hello World\n");
+  return 0;
+}
+
+PUPA_MOD_INIT
+{
+  (void)mod;                   /* To stop warning. */
+  pupa_register_command ("hello", pupa_cmd_hello, PUPA_COMMAND_FLAG_BOTH,
+                        "hello", "Say hello");
+}
+
+PUPA_MOD_FINI
+{
+  pupa_unregister_command ("hello");
+}
index eac49046083a5d99eaa0514e14e31cbfe8869a97..1335859d583be56b7d0fe0d44ec7123338c28a18 100644 (file)
@@ -22,6 +22,7 @@
 #define PUPA_NORMAL_HEADER     1
 
 #include <pupa/setjmp.h>
+#include <pupa/symbol.h>
 
 /* The maximum size of a command-line.  */
 #define PUPA_MAX_CMDLINE       1600
@@ -117,12 +118,12 @@ void pupa_menu_run (pupa_menu_t menu, int nested);
 void pupa_cmdline_run (int nested);
 int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
                      int echo_char, int readline);
-void pupa_register_command (const char *name,
+void EXPORT_FUNC(pupa_register_command) (const char *name,
                            int (*func) (int argc, char *argv[]),
                            unsigned flags,
                            const char *summary,
                            const char *description);
-void pupa_unregister_command (const char *name);
+void EXPORT_FUNC(pupa_unregister_command) (const char *name);
 pupa_command_t pupa_command_find (char *cmdline);
 int pupa_command_execute (char *cmdline);
 void pupa_command_init (void);
index 8f985698ea19356c500087d40408b13b1688e349..9f93904163256ad68315ce23a1768d24707e165e 100644 (file)
@@ -234,7 +234,7 @@ pupa_util_resolve_dependencies (const char *prefix,
   struct dep_list *dep_list;
   struct mod_list *mod_list = 0;
   struct pupa_util_path_list *path_list = 0;
-  
+
   path = pupa_util_get_path (prefix, dep_list_file);
   fp = fopen (path, "r");
   if (! fp)
@@ -253,5 +253,16 @@ pupa_util_resolve_dependencies (const char *prefix,
   free_dep_list (dep_list);
   free_mod_list (mod_list);
 
-  return path_list;
+  { /* Reverse the path_list */
+    struct pupa_util_path_list *p, *prev, *next;
+
+    for (p = path_list, prev = NULL; p; p = next)
+      {
+       next = p->next;
+       p->next = prev;
+       prev = p;
+      }
+
+    return prev;
+  }
 }