hello module and bug fix of util/resolve.c
This commit is contained in:
parent
1f5ab4280a
commit
977329f5fa
5 changed files with 78 additions and 5 deletions
11
ChangeLog
11
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>
|
2003-01-31 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
* kern/i386/pc/lzo1x.S: New file.
|
* kern/i386/pc/lzo1x.S: New file.
|
||||||
|
|
|
@ -61,7 +61,7 @@ pupa_setup_SOURCES = util/i386/pc/pupa-setup.c util/i386/pc/biosdisk.c \
|
||||||
genmoddep_SOURCES = util/genmoddep.c
|
genmoddep_SOURCES = util/genmoddep.c
|
||||||
|
|
||||||
# Modules.
|
# 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.
|
# For _chain.mod.
|
||||||
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
_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/menu.c normal/i386/setjmp.S
|
||||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For hello.mod.
|
||||||
|
hello_mod_SOURCES = hello/hello.c
|
||||||
|
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
|
46
hello/hello.c
Normal file
46
hello/hello.c
Normal file
|
@ -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");
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
#define PUPA_NORMAL_HEADER 1
|
#define PUPA_NORMAL_HEADER 1
|
||||||
|
|
||||||
#include <pupa/setjmp.h>
|
#include <pupa/setjmp.h>
|
||||||
|
#include <pupa/symbol.h>
|
||||||
|
|
||||||
/* The maximum size of a command-line. */
|
/* The maximum size of a command-line. */
|
||||||
#define PUPA_MAX_CMDLINE 1600
|
#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);
|
void pupa_cmdline_run (int nested);
|
||||||
int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
||||||
int echo_char, int readline);
|
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[]),
|
int (*func) (int argc, char *argv[]),
|
||||||
unsigned flags,
|
unsigned flags,
|
||||||
const char *summary,
|
const char *summary,
|
||||||
const char *description);
|
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);
|
pupa_command_t pupa_command_find (char *cmdline);
|
||||||
int pupa_command_execute (char *cmdline);
|
int pupa_command_execute (char *cmdline);
|
||||||
void pupa_command_init (void);
|
void pupa_command_init (void);
|
||||||
|
|
|
@ -234,7 +234,7 @@ pupa_util_resolve_dependencies (const char *prefix,
|
||||||
struct dep_list *dep_list;
|
struct dep_list *dep_list;
|
||||||
struct mod_list *mod_list = 0;
|
struct mod_list *mod_list = 0;
|
||||||
struct pupa_util_path_list *path_list = 0;
|
struct pupa_util_path_list *path_list = 0;
|
||||||
|
|
||||||
path = pupa_util_get_path (prefix, dep_list_file);
|
path = pupa_util_get_path (prefix, dep_list_file);
|
||||||
fp = fopen (path, "r");
|
fp = fopen (path, "r");
|
||||||
if (! fp)
|
if (! fp)
|
||||||
|
@ -253,5 +253,16 @@ pupa_util_resolve_dependencies (const char *prefix,
|
||||||
free_dep_list (dep_list);
|
free_dep_list (dep_list);
|
||||||
free_mod_list (mod_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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue