Commit Graph

54 Commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko c6f2fe52f1 2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
Wait for user entry basing on presence of output rather than on errors.

	* include/grub/normal.h (grub_normal_get_line_counter): New proto.
	(grub_install_newline_hook): Likewise.
	* normal/main.c (GRUB_MOD_INIT): Call grub_install_newline_hook.
	* normal/menu.c (show_menu): Check line_counter to determine presence
	of output.
	* normal/term.c (grub_normal_line_counter): New variable.
	(grub_normal_get_line_counter): New function.
	(grub_install_newline_hook): Likewise.
2010-03-01 20:58:45 +01:00
Vladimir 'phcoder' Serbinenko e28e32ae51 2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/normal.h [GRUB_UTIL]: Remove leftover declarations.
	* include/grub/partition.h [GRUB_UTIL]: Likewise.
2010-02-07 16:52:47 +01:00
Vladimir 'phcoder' Serbinenko 61c501a941 merge mainline into newenv 2010-01-20 21:31:39 +01:00
Vladimir 'phcoder' Serbinenko 6066889c88 normal_exit command 2009-12-25 16:28:31 +01:00
Vladimir 'phcoder' Serbinenko 33c1ed4c8d terminal modules autoloading 2009-12-25 03:37:20 +01:00
Vladimir 'phcoder' Serbinenko 2e71383172 Core changes hopefully finished 2009-12-24 15:34:33 +01:00
Vladimir 'phcoder' Serbinenko e48625a306 merge crypto into multiout 2009-12-24 00:38:41 +01:00
Vladimir 'phcoder' Serbinenko f4c623e170 Work on multi-out terminal 2009-12-24 00:37:11 +01:00
Vladimir 'phcoder' Serbinenko 7316783f35 Crypto module autoloading 2009-12-23 17:33:35 +01:00
Vladimir 'phcoder' Serbinenko 0866ec655e merge mainline to newenv 2009-12-22 14:14:28 +01:00
carles 7f39d92f8d 2009-12-20 Carles Pina i Estany <carles@pina.cat>
* include/grub/auth.h: Include `<grub/i18n.h>'.
	(GRUB_GET_PASSWORD): Gettextizze string.
	* include/grub/normal.h (STANDARD_MARGIN): New macro, moved from
	menu_text.c.
	(grub_utf8_to_ucs4_alloc): Fix indentation.
	(grub_print_ucs4): Likewise.
	(grub_getstringwidth): Likewise.
	(print_message_indented): New declaration.
	* normal/auth.c: Include `<grub/i18n.h>'.
	(grub_auth_check_authentication): Gettexttize string.
	* normal/cmdline.c: Include `<grub/i18n.h>'.
	(grub_cmdline_get): Gettextizze.
	* normal/color.c: Include `<grub/i18n.h>'.
	(grub_parse_color_name_pair): Gettexttize strings.
	* normal/main.c (grub_normal_reader_init): Cleanup gettexttized
	string (use `print_message_indented').
	* normal/menu_text.c (STANDARD_MARGIN): Moved from here to
	`include/grub/normal.h'.
	(print_message_indented): Renamed to ...
	(grub_print_message_indented): ... this. Remove `static' qualifer (now
	used in normal/main.c).
	(print_message): Use `grub_print_message_indented' instead of
	`print_message_indented'.
	(print_timeout): Likewise.
	* normal/misc.c: Include `<grub/term.h>' and `<grub/i18n.h>'.
	(grub_normal_print_device_info): Gettexttize strings.
	* po/POTFILES: Add `auth.c', `color.c' and `misc.c'.
2009-12-20 23:32:15 +00:00
Vladimir 'phcoder' Serbinenko 902a478aab merge trunk into newenv 2009-12-20 14:20:37 +01:00
Vladimir 'phcoder' Serbinenko 2fbcbbc389 Save 314 bytes on not handling contexts in core 2009-12-20 02:52:39 +01:00
carles b99518d1ce 2009-12-19 Carles Pina i Estany <carles@pina.cat>
* include/grub/normal.h (grub_utf8_to_ucs4): New declaration.
	(grub_print_ucs4_alloc): Likewise.
	(grub_getstringwidth): Likewise.
	* normal/main.c (grub_normal_init_page): Gettextize version string.
	* normal/menu_text.c (grub_utf8_to_ucs4_alloc): New definition.
	(getstringwidth): Renamed to ...
	(grub_getstringwidth): ... this. Remove `static' qualifier (now used
	in normal/main.c).  Use `grub_utf8_to_ucs4_alloc'.
	(grub_print_ucs4): Remove `static' qualifer (now used in
	normal/main.c).
	* po/POTFILES: Add normal/main.c.
2009-12-19 23:00:30 +00:00
phcoder e7e1f93ff6 2009-08-25 Vladimir Serbinenko <phcoder@gmail.com>
Authentication support.

	* commands/password.c: New file.
	* conf/common.rmk (pkglib_MODULES): Add password.mod.
	(password_mod_SOURCES): New variable.
	(password_mod_CFLAGS): Likewise.
	(password_mod_LDFLAGS): Likewise.
	(normal_mod_SOURCES): Add normal/auth.c.
	* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add commands/password.c and
	normal/auth.c.
	* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
	* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
	* include/grub/auth.h: New file.
	* include/grub/err.h (grub_err_t): New enum value
	GRUB_ERR_ACCESS_DENIED.
	* include/grub/menu.h (grub_menu_entry): New fields 'restricted' and
	'users'.
	* include/grub/normal.h (grub_cmdline_get): New argument 'history'.
	* normal/cmdline.c (grub_cmdline_get): New argument 'history'. All
	users updated.
	* normal/auth.c: New file.
	* normal/main.c (grub_normal_add_menu_entry): Handle --users option.
	(grub_cmdline_run): Don't allow to go to command line without
	authentication.
	* normal/menu.c (grub_menu_execute_entry): Handle restricted entries.
	* normal/menu_entry.c (grub_menu_entry_run): Don't allow editing
	menuentry without superuser rights.
	* normal/menu_viewer.c (grub_menu_viewer_show_menu): Don't exit if
	user isn't a superuser.
2009-08-24 23:55:06 +00:00
cbennett 230c0ad633 2009-05-23 Colin D Bennett <colin@gibibit.com>
Cleaned up `include/grub/normal.h'.  Grouped prototypes by
	definition file, and functions defined in `normal/menu.c' have had
	their prototypes moved to `include/grub/menu.h' for consistency.

	* include/grub/menu.h (grub_menu_execute_callback): Added; moved
	from normal.h.
	(grub_menu_get_entry): Likewise.
	(grub_menu_get_timeout): Likewise.
	(grub_menu_set_timeout): Likewise.
	(grub_menu_execute_entry): Likewise.
	(grub_menu_execute_with_fallback): Likewise.
	(grub_menu_entry_run): Likewise.

	* include/grub/normal.h: Re-ordered and grouped function
	prototypes by file that the function is defined in.
	(grub_menu_execute_callback): Removed; moved to menu.h.
	(grub_menu_get_entry): Likewise.
	(grub_menu_get_timeout): Likewise.
	(grub_menu_set_timeout): Likewise.
	(grub_menu_execute_entry): Likewise.
	(grub_menu_execute_with_fallback): Likewise.
	(grub_menu_entry_run): Likewise.
	(grub_menu_addentry): Renamed from this ...
	(grub_normal_add_menu_entry): ... to this.

	* normal/main.c (grub_menu_addentry): Renamed from this ...
	(grub_normal_add_menu_entry): ... to this.

	* script/sh/execute.c (grub_script_execute_menuentry): Update
	reference to renamed grub_menu_addentry function.
2009-05-24 08:39:29 +00:00
bean d558e6b5ac 2009-05-02 Bean <bean123ch@gmail.com>
* conf/common.rmk (grub_script.tab.c): Change normal/parser.y to
	script/sh/parser.y.
	(pkglib_MODULES): Add normal.mod and sh.mod.
	(normal_SOURCES): New variable.
	(normal_mod_CFLAGS): Likewise.
	(normal_mod_LDFLAGS): Likewise.
	(sh_mod_SOURCES): Likewise.
	(sh_mod_CFLAGS): Likewise.
	(sh_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (normal/lexer.c_DEPENDENCIES): Changed to
	script/sh/lexer.c_DEPENDENCIES.
	(kernel_img_SOURCES): Remove kern/rescue.c, and kern/reader.c,
	kern/rescue_reader.c and kern/rescue_parser.c.
	(kernel_img_HEADERS): Remove rescue.h, add reader.h.
	(grub_emu_SOURCES): Change source files.
	(pkglib_MODULES): Remove normal.mod.
	(normal_SOURCES): Removed.
	(normal_mod_CFLAGS): Likewise.
	(normal_mod_LDFLAGS): Likewise.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1276.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/sparc64-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/command.h (grub_command_execute): New inline function.

	* include/grub/menu.h (grub_menu_entry): Removed commands field.

	* include/grub/normal.h: Remove <grub/setjmp.h>.
	(grub_fs_module_list): Moved to normal/autofs.c.
	(grub_exit_env): Removed.
	(grub_command_execute): Likewise.
	(grub_normal_menu_addentry): Renamed to grub_menu_addentry, removed
	parameter script.
	(read_command_list): New function declaration.
	(read_fs_list): Likewise.

	* include/parser.h: Include <grub/reader.h>.
	(grub_parser_split_cmdline): Change type of getline parameter.
	(grub_parser): New structure.
	(grub_parser_class): New variable.
	(grub_parser_execute): New function declaration.
	(grub_register_rescue_parser): Likewise.
	(grub_parser_register): New inline function.
	(grub_parser_unregister): Likewise.
	(grub_parser_get_current): Likewise.
	(grub_parser_set_current): Likewise.

	* include/grub/reader.h: New file.
	* kern/reader.c: Likewise.
	* kern/rescue_parser.c: Likewise.
	* kern/rescue_reader.c: Likewise.
	* normal/autofs.c: Likewise.
	* normal/dyncmd.c: Likewise.

	* include/grub/rescue.h: Removed.
	* normal/command.h: Likewise.

	* include/grub/script.h: Moved to ...
	* include/grub/script_sh.h: ... Moved here.
	* normal/execute.c: Moved to ...
	* script/sh/execute.c: ... Moved here.
	* normal/function.c: Moved to ...
	* script/sh/function.c: ... Moved here.
	* normal/lexer.c: Moved to ...
	* script/sh/lexer.c: ... Moved here.
	* normal/parser.y: Moved to ...
	* script/sh/parser.y: ... Moved here.
	* normal/script.c: Moved to ...
	* script/sh/script.c: ... Moved here.

	* normal/main.c: Remove <grub/rescue.h> and <grub/script.h>, include
	<grub/reader.h>.
	(grub_exit_env): Removed.
	(fs_module_list): Moved to normal/autofs.c.
	(grub_file_getline): Don't handle comment here.
	(free_menu): Skip removed field entry->commands.
	(grub_normal_menu_addentry): Removed as grub_menu_entry, removed
	script parameter.
	(read_config_file): Removed nested parameter, change getline function.
	(grub_enter_normal_mode): Removed.
	(grub_dyncmd_dispatcher): Moved to normal/dyncmd.c.
	(read_command_list): Likewise.
	(autoload_fs_module): Moved to normal/autofs.c.
	(read_fs_list): Likewise.
	(reader_nested): New variable.
	(grub_normal_execute): Run parser.sh to switch to sh parser.
	(grub_cmd_rescue): Removed.
	(cmd_normal): Removed.
	(grub_cmd_normal): Unregister itself at the beginning. Don't register
	rescue command.
	(grub_cmdline_run): New function.
	(grub_normal_reader_init): Likewise.
	(grub_normal_read_line): Likewise.
	(grub_env_write_pager): Likewise.
	(cmdline): New variable.
	(grub_normal_reader): Likewise.
	(GRUB_MOD_INIT): Register normal reader and set as current, register
	pager hook, register normal command with grub_register_command_prio,
	so that it won't show up in command.lst.
	(GRUB_MOD_FINI): Unregister normal reader, unhook pager, clear
	grub_fs_autoload_hook.

	* normal/menu.c: Remove <grub/script.h>, add <grub/command.h>.
	(grub_menu_execute_entry): Replace grub_script_execute with
	grub_parser_execute, change parameter to grub_command_execute.

	* normal/menu_text.c: Remove <grub/script.h>.

	* normal/menu_entry.c: Remove <grub/script.h>, add <grub/command.h>
	and <grub/parser.h>.
	(run): Change editor_getline to use new parser interface. Change
	parameter to grub_command_execute.

	* kern/main.c: Remove <grub/rescue.h>, include <grub/command.h>,
	<grub/reader.h> and <grub/parser.h>.
	(grub_load_normal_mode): Execute normal command.
	(grub_main): Call grub_register_core_commands,
	grub_register_rescue_parser and grub_register_rescue_reader, use
	grub_reader_loop to enter input loop.

	* kern/parser.c (grub_parser_spli_cmdline): Change type of getline
	parameter.
	(grub_parser_class): New variable.
	(grub_parser_execute): New function.

	* loader/i386/multiboot.c: Remove <grub/rescue.h>.
	* loader/multiboot2.c: Likewise.
	* loader/sparc64/ieee1275/linux.c: Likewise.

	* util/grub-emu.c (read_command_list): New dummy function.
2009-05-02 19:49:34 +00:00
bean d05f0df3eb 2009-04-14 Bean <bean123ch@gmail.com>
* Makefile.in (pkglib_DATA): Add handler.lst.
	(handler.lst): New rule.

	* conf/i386-pc.rmk (normal_mod_SOURCES): Add normal/handler.c.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/sparc64-ieee1275.rmk: Likewise.

	* genhandlerlist.sh: New file.

	* genmk.rb: Add rules to generate handler.lst.

	* include/grub/normal.h (grub_file_getline): New function definition.
	(read_handler_list): Likewise.
	(free_handler_list): Likewise.

	* include/grub/term.h (grub_term_register_input): Add name parameter
	for auto generation of handler.lst.
	(grub_term_register_output): Likewise.

	* normal/handler.c: New file.

	* normal/main.c (get_line): Renamed to grub_file_getline.
	(read_config_file): Use the newly renamed grub_file_getline.
	(read_command_list): Likewise.
	(read_fs_list): Likewise.
	(grub_normal_execute): Call read_handler_list to parse handler.lst.
	(GRUB_MOD_FINI): Call free_handler_list to free handler list.

	* term/efi/console.c (grub_console_init): Add name parameter for auto
	generation of handler.lst.
	* term/gfxterm.c: Likewise.
	* term/i386/pc/at_keyboard.c: Likewise.
	* term/i386/pc/console.c: Likewise.
	* term/i386/pc/serial.c: Likewise.
	* term/i386/pc/vesafb.c: Likewise.
	* term/i386/pc/vga.c: Likewise.
	* term/i386/pc/vga_text.c: Likewise.
	* term/ieee1275/ofconsole.c: Likewise.
	* term/usb_keyboard.c: Likewise.
2009-04-14 18:12:14 +00:00
okuji f04f02e496 2009-03-22 Yoshinori K. Okuji <okuji@enbug.org>
* normal/main.c (grub_normal_execute): Added an argument
    BATCH to specify if an interactive interface should be provided
    after reading a config file.
    All callers updated.
    (read_command_list): Prevent being executed twice.
    (read_fs_list): Likewise.

    * include/grub/normal.h (grub_normal_execute):
2009-03-22 10:05:31 +00:00
bean b1b797cb1b 2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
	<grub/normal.h> and <grub/arg.h>.
	(grub_cmd_blocklist): Use the new command interface.
	(GRUB_MOD_INIT): Likewise.
	(GRUB_MOD_FINI): Likewise.
	* commands/boot.c: Likewise.
	* commands/cat.c: Likewise.
	* commands/cmp.c: Likewise.
	* commands/configfile.c: Likewise.
	* commands/crc.c: Likewise.
	* commands/echo.c: Likewise.
	* commands/halt.c: Likewise.
	* commands/handler.c: Likewise.
	* commands/hdparm.c: Likewise.
	* commands/help.c: Likewise.
	* commands/hexdump.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/ls.c: Likewise.
	* commands/lsmmap.c: Likewise.
	* commands/lspci.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/read.c: Likewise.
	* commands/reboot.c: Likewise.
	* commands/search.c: Likewise.
	* commands/sleep.c: Likewise.
	* commands/test.c: Likewise.
	* commands/usbtest.c: Likewise.
	* commands/videotest.c: Likewise.
	* commands/i386/cpuid.c: Likewise.
	* commands/i386/pc/halt.c: Likewise.
	* commands/i386/pc/play.c: Likewise.
	* commands/i386/pc/pxecmd.c: Likewise.
	* commands/i386/pc/vbeinfo.c: Likewise.
	* commands/i386/pc/vbetest.c: Likewise.
	* commands/ieee1275/suspend.c: Likewise.
	* disk/loopback.c: Likewise.
	* font/font_cmd.c: Likewise.
	* hello/hello.c: Likewise.
	* loader/efi/appleloader.c: Likewise.
	* loader/efi/chainloader.c: Likewise.
	* loader/i386/bsd.c: Likewise.
	* loader/i386/efi/linux.c: Likewise.
	* loader/i386/ieee1275/linux.c: Likewise.
	* loader/i386/linux.c: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/powerpc/ieee1275/linux.c: Likewise.
	* loader/multiboot_loader.c: Likewise.
	* term/gfxterm.c: Likewise.
	* term/i386/pc/serial.c: Likewise.
	* term/terminfo.c: Likewise.

	* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
	* term/i386/pc/vga.c: Likewise.
	* video/readers/jpeg.c: Likewise.
	* video/readers/png.c: Likewise.
	* video/readers/tga.c: Likewise.

	* util/grub-fstest (cmd_loopback): Removed.
	(cmd_blocklist): Likewise.
	(cmd_ls): Likewise.
	(grub_register_command): Likewise.
	(grub_unregister_command): Likewise.
	(execute_command): Use grub_command_find to locate command and execute
	it.

	* include/grub/efi/chainloader.h: Removed.
	* loader/efi/chainloader_normal.c: Likewise.
	* loader/i386/bsd_normal.c: Likewise.
	* loader/i386/pc/chainloader_normal.c: Likewise.
	* loader/i386/pc/multiboot_normal.c: Likewise.
	* loader/linux_normal.c: Likewise.
	* loader/multiboot_loader_normal.c: Likewise.
	* loader/powerpc/ieee1275/linux_normal.c: Likewise.

	* gencmdlist.sh: Scan new registration command grub_register_extcmd
	and grub_register_command_p1.

	* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
	kern/command.c, lib/arg.c and commands/extcmd.c.
	(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
	(minicmd_mod_SOURCES): New variable.
	(minicmd_mod_CFLAGS): Likewise.
	(minicmd_mod_LDFLAGS): Likewise.
	(extcmd_mod_SOURCES): Likewise.
	(extcmd_mod_CFLAGS): Likewise.
	(extcmd_mod_LDFLAGS): Likewise.
	(boot_mod_SOURCES): Removed.
	(boot_mod_CFLAGS): Likewise.
	(boot_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
	kern/corecmd.c.
	(kernel_img_HEADERS): Add command.h.
	(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
	commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
	and lib/arg.c.
	(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
	_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
	remove the corresponding normal mode command.
	(normal_mod_SOURCES): Remove normal/arg.c.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/arg.h: Move from here ...
	* include/grub/lib/arg.h: ... to here.

	* normal/arg.c: Move from here ...
	* lib/arg.c: ... to here.

	* commands/extcmd.c: New file.
	* commands/minicmd.c: Likewise.
	* include/grub/command.h: Likewise.
	* include/grub/extcmd.h: Likewise.
	* kern/command.c: Likewise.
	* kern/corecmd.c: Likewise.

	* kern/list.c (grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(grub_prio_list_insert): Likewise.

	* kern/rescue.c (grub_rescue_command): Removed.
	(grub_rescue_command_list): Likewise.
	(grub_rescue_register_command): Likewise.
	(grub_rescue_unregister_command): Likewise.
	(grub_rescue_cmd_boot): Move to minicmd.c
	(grub_rescue_cmd_help): Likewise.
	(grub_rescue_cmd_info): Likewise.
	(grub_rescue_cmd_boot): Likewise.
	(grub_rescue_cmd_testload): Likewise.
	(grub_rescue_cmd_dump): Likewise.
	(grub_rescue_cmd_rmmod): Likewise.
	(grub_rescue_cmd_lsmod): Likewise.
	(grub_rescue_cmd_exit): Likewise.
	(grub_rescue_print_devices): Moved to corecmd.c.
	(grub_rescue_print_files): Likewise.
	(grub_rescue_cmd_ls): Likewise.
	(grub_rescue_cmd_insmod): Likewise.
	(grub_rescue_cmd_set): Likewise.
	(grub_rescue_cmd_unset): Likewise.
	(attemp_normal_mode): Use grub_command_find to get normal module.
	(grub_enter_rescue_mode): Use grub_register_core_commands to register
	commands, remove grub_rescue_regiter_command calls.

	* normal/command.c (grub_regiser_command): Removed.
	(grub_unregister_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(rescue_command): Likewise.
	(export_command): Moved to corecmd.c.
	(set_command): Removed.
	(unset_command): Likewise.
	(insmod_command): Likewise.
	(rmmod_command): Likewise.
	(lsmod_command): Likewise.
	(grub_command_init): Likewise.

	* normal/completion.c (iterate_command): Use cmd->prio to check for
	active command.
	(complete_arguments): Use grub_extcmd_t structure to find options.
	(grub_normal_do_completion): Change function grub_iterate_commands to
	grub_command_iterate.

	* normal/execute.c (grub_script_execute_cmd): No need to parse
	argument here.

	* normal/main.c (grub_dyncmd_dispatcher): New function.
	(read_command_list): Register unload commands as dyncmd.
	(grub_cmd_normal): Use new command interface, register rescue,
	unregister normal at entry, register normal, unregister rescue at exit.

	* include/grub/list.h (grub_list_test_t): New type.
	(grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(GRUB_AS_NAMED_LIST_P): New macro.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	(GRUB_PRIO_LIST_PRIO_MASK): New constant.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
	(grub_prio_list): New structure.
	(grub_prio_list_insert): New function.
	(grub_prio_list_remove): New inline function.

	* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
	(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Likewise.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
	(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
	(grub_command): Likewise.
	(grub_register_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(grub_command_init): Likewise.
	(grub_arg_parse): Likewise.
	(grub_arg_show_help): Likewise.

	* include/grub/rescue.h (grub_rescue_register_command): Removed.
	(grub_rescue_unregister_command): Likewise.

	* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
	grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
	grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.

	* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
	grub_rescue_cmd_initrd.
	* include/grub/i386/loader.h: Likewise.
	* include/grub/x86_64/loader.h: Likewise.

	* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
cbennett 772e23dad2 2009-02-13 Colin D Bennett <colin@gibibit.com>
Support multiple fallback entries, and provide an API to support
	executing default+fallback menu entries.  Renamed the `terminal' menu
	viewer to `text'.

	* include/grub/normal.h (grub_normal_text_menu_viewer): New global
	variable declaration.
	(grub_menu_execute_callback): New structure declaration.
	(grub_menu_execute_callback_t): New typedef.
	(grub_menu_execute_with_fallback): New function declaration.
	(grub_menu_get_entry): Likewise.
	(grub_menu_get_timeout): Likewise.
	(grub_menu_set_timeout): Likewise.

	* normal/main.c (GRUB_MOD_INIT(normal)): Refer to new variable name.

	* normal/menu.c (grub_wait_after_message): Moved to
	`normal/menu_text.c'.
	(draw_border): Likewise.
	(print_message): Likewise.
	(print_entry): Likewise.
	(print_entries): Likewise.
	(grub_menu_init_page): Likewise.
	(get_entry_number): Likewise.
	(print_timeout): Likewise.
	(run_menu): Likewise.
	(grub_menu_execute_entry): Likewise.
	(show_text_menu): Likewise.
	(get_and_remove_first_entry_number): New function.
	(grub_menu_execute_with_fallback): Likewise.
	(get_entry): Renamed to ...
	(grub_menu_get_entry): .. this and made it global.
	(get_timeout): Renamed to ...
	(grub_menu_get_timeout): ... this and made it global.
	(set_timeout): Renamed to ...
	(grub_menu_set_timeout): ... this and made it global.
	(grub_normal_terminal_menu_viewer): Renamed to ...
	(grub_normal_text_menu_viewer): ... this.

	* normal/menu_text.c: New file.  Extracted text-menu-specific code
	from normal/menu.c.

	* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add `normal/menu_text.c'.
	(normal_mod_SOURCES): Likewise.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.

	* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.

	* conf/i386-pc.rmk, (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.

	* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.

	* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
	(normal_mod_SOURCES): Likewise.
2009-02-13 20:06:27 +00:00
chaac 6fa42fa65a 2009-01-31 Colin D Bennett <colin@gibibit.com>
* normal/main.c: Add include to grub/menu_viewer.h. 
	(free_menu_entry_classes): Added.
	(grub_normal_menu_addentry): Added class property handling.
	(grub_normal_execute): Changed to use new menu viewer for menu viewing.
	(GRUB_MOD_INIT(normal)): Added register for text based menu viewer.

	* normal/menu_viewer.c: New file.

	* normal/menu.c (run_menu_entry): Renamed to ...
	(grub_menu_execute_entry): ... this and	made it as global.
	(grub_menu_run): Renamed to ...
	(show_text_menu): ... this and made it local.
	(show_text_menu): Adapt to new function names.
	(grub_normal_terminal_menu_viewer): New global variable.

	* include/grub/menu.h: New file.

	* include/grub/menu_viewer.h: New file.

	* include/grub/normal.h: Added include to grub/menu.h.
	(grub_menu_entry): Moved to include/grub/menu.h.
	(grub_menu_entry_t): Likewise.
	(grub_menu): Likewise.
	(grub_menu_t): Likewise.
	(grub_normal_terminal_menu_viewer): Added.
	(grub_menu_execute_entry): Likewise.
	(grub_menu_run): Removed.

	* DISTLIST: Added include/grub/menu.h.
	Added include/grub/menu_viewer.h.
	Added normal/menu_viewer.c.

2009-01-31  Vesa Jääskeläinen  <chaac@nic.fi>

	* normal/execute.c (grub_script_execute_menuentry): Changed to use
	arglist for menutitle arguments.

	* normal/main.c (grub_normal_menu_addentry): Likewise.

	* normal/parser.y (menuentry): Likewise.

	* normal/script.c (grub_script_create_cmdmenu): Likewise.

	* include/grub/script.h (grub_script_cmd_menuentry): Likewise.
	(grub_script_create_cmdmenu): Likewise.

	* include/grub/normal.h (grub_normal_menu_addentry): Likewise.

	* conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's
	changes.

	* conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise.

	* conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise.

	* conf/i386-efi.rmk (normal_mod_SOURCES): Likewise.

	* conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise.

	* conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise.

	* conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise.
2009-01-31 09:15:43 +00:00
chaac a0224a4e62 2008-09-01 Colin D Bennett <colin@gibibit.com>
* include/grub/normal.h: Fixed incorrect comment for
	GRUB_COMMAND_FLAG_NO_ARG_PARSE.
2008-09-01 19:03:16 +00:00
proski c5dfd43b5f 2008-03-26 Pavel Roskin <proski@gnu.org>
* normal/color.c (grub_parse_color_name_pair): Make `name' a
	const.
	* include/grub/normal.h: Add grub_parse_color_name_pair()
	declaration.
2008-03-26 13:01:02 +00:00
jeroen f3b58148d6 2008-01-05 Jeroen Dekkers <jeroen@dekkers.cx>
* include/grub/normal.h: Include <grub/env.h>.
2008-01-05 21:45:21 +00:00
robertmh 0ece25b1e1 2008-01-05 Robert Millan <rmh@aybabtu.com>
* include/grub/normal.h (grub_env_write_color_normal): New prototype.
	(grub_env_write_color_highlight): Likewise.
	(grub_wait_after_message): Likewise.

	* normal/color.c: New file.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'.
	(normal_mod_DEPENDENCIES): Likewise.

	* normal/menu_entry.c (run): Rely on grub_wait_after_message()
	for waiting after a message is printed.
	* normal/main.c (read_config_file): Likewise.
	(grub_normal_init): Register grub_env_write_color_normal() and
	grub_env_write_color_highlight() hooks.  Mark `color_normal' and
	`color_highlight' variables as global.

	* normal/menu.c (grub_wait_after_message): New function.
	(grub_color_menu_normal): New variable.  Replaces ...
	(GRUB_COLOR_MENU_NORMAL): ... this macro.
	(grub_color_menu_highlight): New variable.  Replaces ...
	(GRUB_COLOR_MENU_HIGHLIGHT): ... this macro.
	(draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of
	`GRUB_TERM_COLOR_STANDARD'.
	(print_message): Use `grub_setcolorstate' to reload colors.  Rename
	`normal_code' and `highlight_code' to `old_color_normal' and
	`old_color_highlight', respectively.
	(grub_menu_init_page): Update colors when drawing the menu, based on
	`menu_color_normal' and `menu_color_highlight' variables.
	(grub_menu_run): Rely on grub_wait_after_message() for waiting after
	a message is printed.
2008-01-05 12:10:28 +00:00
okuji 5a79f472c7 2007-07-22 Yoshinori K. Okuji <okuji@enbug.org>
Migrate to GNU General Public License Version 3.

    * COPYING: Replaced with the plain text version of GPLv3.

    * config.guess: Updated from gnulib.
    * config.sub: Likewise.

    * geninit.sh: Output a GPLv3 copyright notice.
    * geninitheader.sh: Likewise.
    * genmodsrc.sh: Likewise.
    * gensymlist.sh.in: Likewise.

    * boot/i386/pc/boot.S: Upgraded to GPLv3.
    * boot/i386/pc/diskboot.S: Likewise.
    * boot/i386/pc/pxeboot.S: Likewise.
    * commands/blocklist.c: Likewise.
    * commands/boot.c: Likewise.
    * commands/cat.c: Likewise.
    * commands/cmp.c: Likewise.
    * commands/configfile.c: Likewise.
    * commands/echo.c: Likewise.
    * commands/help.c: Likewise.
    * commands/ls.c: Likewise.
    * commands/search.c: Likewise.
    * commands/terminal.c: Likewise.
    * commands/test.c: Likewise.
    * commands/videotest.c: Likewise.
    * commands/i386/cpuid.c: Likewise.
    * commands/i386/pc/halt.c: Likewise.
    * commands/i386/pc/play.c: Likewise.
    * commands/i386/pc/reboot.c: Likewise.
    * commands/i386/pc/vbeinfo.c: Likewise.
    * commands/i386/pc/vbetest.c: Likewise.
    * commands/ieee1275/halt.c: Likewise.
    * commands/ieee1275/reboot.c: Likewise.
    * commands/ieee1275/suspend.c: Likewise.
    * disk/loopback.c: Likewise.
    * disk/lvm.c: Likewise.
    * disk/raid.c: Likewise.
    * disk/efi/efidisk.c: Likewise.
    * disk/i386/pc/biosdisk.c: Likewise.
    * disk/ieee1275/ofdisk.c: Likewise.
    * font/manager.c: Likewise.
    * fs/affs.c: Likewise.
    * fs/ext2.c: Likewise.
    * fs/fat.c: Likewise.
    * fs/fshelp.c: Likewise.
    * fs/hfs.c: Likewise.
    * fs/hfsplus.c: Likewise.
    * fs/iso9660.c: Likewise.
    * fs/jfs.c: Likewise.
    * fs/minix.c: Likewise.
    * fs/sfs.c: Likewise.
    * fs/ufs.c: Likewise.
    * fs/xfs.c: Likewise.
    * hello/hello.c: Likewise.
    * include/grub/acorn_filecore.h: Likewise.
    * include/grub/arg.h: Likewise.
    * include/grub/bitmap.h: Likewise.
    * include/grub/boot.h: Likewise.
    * include/grub/cache.h: Likewise.
    * include/grub/device.h: Likewise.
    * include/grub/disk.h: Likewise.
    * include/grub/dl.h: Likewise.
    * include/grub/elfload.h: Likewise.
    * include/grub/env.h: Likewise.
    * include/grub/err.h: Likewise.
    * include/grub/file.h: Likewise.
    * include/grub/font.h: Likewise.
    * include/grub/fs.h: Likewise.
    * include/grub/fshelp.h: Likewise.
    * include/grub/gzio.h: Likewise.
    * include/grub/hfs.h: Likewise.
    * include/grub/kernel.h: Likewise.
    * include/grub/loader.h: Likewise.
    * include/grub/lvm.h: Likewise.
    * include/grub/misc.h: Likewise.
    * include/grub/mm.h: Likewise.
    * include/grub/net.h: Likewise.
    * include/grub/normal.h: Likewise.
    * include/grub/parser.h: Likewise.
    * include/grub/partition.h: Likewise.
    * include/grub/pc_partition.h: Likewise.
    * include/grub/raid.h: Likewise.
    * include/grub/rescue.h: Likewise.
    * include/grub/script.h: Likewise.
    * include/grub/setjmp.h: Likewise.
    * include/grub/symbol.h: Likewise.
    * include/grub/term.h: Likewise.
    * include/grub/terminfo.h: Likewise.
    * include/grub/tparm.h: Likewise.
    * include/grub/types.h: Likewise.
    * include/grub/video.h: Likewise.
    * include/grub/efi/api.h: Likewise.
    * include/grub/efi/chainloader.h: Likewise.
    * include/grub/efi/console.h: Likewise.
    * include/grub/efi/console_control.h: Likewise.
    * include/grub/efi/disk.h: Likewise.
    * include/grub/efi/efi.h: Likewise.
    * include/grub/efi/pe32.h: Likewise.
    * include/grub/efi/time.h: Likewise.
    * include/grub/i386/linux.h: Likewise.
    * include/grub/i386/setjmp.h: Likewise.
    * include/grub/i386/types.h: Likewise.
    * include/grub/i386/efi/kernel.h: Likewise.
    * include/grub/i386/efi/loader.h: Likewise.
    * include/grub/i386/efi/time.h: Likewise.
    * include/grub/i386/pc/biosdisk.h: Likewise.
    * include/grub/i386/pc/boot.h: Likewise.
    * include/grub/i386/pc/chainloader.h: Likewise.
    * include/grub/i386/pc/console.h: Likewise.
    * include/grub/i386/pc/init.h: Likewise.
    * include/grub/i386/pc/kernel.h: Likewise.
    * include/grub/i386/pc/loader.h: Likewise.
    * include/grub/i386/pc/memory.h: Likewise.
    * include/grub/i386/pc/multiboot.h: Likewise.
    * include/grub/i386/pc/serial.h: Likewise.
    * include/grub/i386/pc/time.h: Likewise.
    * include/grub/i386/pc/vbe.h: Likewise.
    * include/grub/i386/pc/vbeblit.h: Likewise.
    * include/grub/i386/pc/vbefill.h: Likewise.
    * include/grub/i386/pc/vbeutil.h: Likewise.
    * include/grub/i386/pc/vga.h: Likewise.
    * include/grub/ieee1275/ieee1275.h: Likewise.
    * include/grub/ieee1275/ofdisk.h: Likewise.
    * include/grub/powerpc/libgcc.h: Likewise.
    * include/grub/powerpc/setjmp.h: Likewise.
    * include/grub/powerpc/types.h: Likewise.
    * include/grub/powerpc/ieee1275/biosdisk.h: Likewise.
    * include/grub/powerpc/ieee1275/console.h: Likewise.
    * include/grub/powerpc/ieee1275/ieee1275.h: Likewise.
    * include/grub/powerpc/ieee1275/kernel.h: Likewise.
    * include/grub/powerpc/ieee1275/loader.h: Likewise.
    * include/grub/powerpc/ieee1275/multiboot.h: Likewise.
    * include/grub/powerpc/ieee1275/time.h: Likewise.
    * include/grub/powerpc/ieee1275/util/biosdisk.h: Likewise.
    * include/grub/sparc64/libgcc.h: Likewise.
    * include/grub/sparc64/setjmp.h: Likewise.
    * include/grub/sparc64/types.h: Likewise.
    * include/grub/sparc64/ieee1275/console.h: Likewise.
    * include/grub/sparc64/ieee1275/ieee1275.h: Likewise.
    * include/grub/sparc64/ieee1275/kernel.h: Likewise.
    * include/grub/sparc64/ieee1275/time.h: Likewise.
    * include/grub/util/biosdisk.h: Likewise.
    * include/grub/util/getroot.h: Likewise.
    * include/grub/util/lvm.h: Likewise.
    * include/grub/util/misc.h: Likewise.
    * include/grub/util/raid.h: Likewise.
    * include/grub/util/resolve.h: Likewise.
    * io/gzio.c: Likewise.
    * kern/device.c: Likewise.
    * kern/disk.c: Likewise.
    * kern/dl.c: Likewise.
    * kern/elf.c: Likewise.
    * kern/env.c: Likewise.
    * kern/err.c: Likewise.
    * kern/file.c: Likewise.
    * kern/fs.c: Likewise.
    * kern/loader.c: Likewise.
    * kern/main.c: Likewise.
    * kern/misc.c: Likewise.
    * kern/mm.c: Likewise.
    * kern/parser.c: Likewise.
    * kern/partition.c: Likewise.
    * kern/rescue.c: Likewise.
    * kern/term.c: Likewise.
    * kern/efi/efi.c: Likewise.
    * kern/efi/init.c: Likewise.
    * kern/efi/mm.c: Likewise.
    * kern/i386/dl.c: Likewise.
    * kern/i386/efi/init.c: Likewise.
    * kern/i386/efi/startup.S: Likewise.
    * kern/i386/pc/init.c: Likewise.
    * kern/i386/pc/lzo1x.S: Likewise.
    * kern/i386/pc/startup.S: Likewise.
    * kern/ieee1275/ieee1275.c: Likewise.
    * kern/powerpc/cache.S: Likewise.
    * kern/powerpc/dl.c: Likewise.
    * kern/powerpc/ieee1275/cmain.c: Likewise.
    * kern/powerpc/ieee1275/crt0.S: Likewise.
    * kern/powerpc/ieee1275/init.c: Likewise.
    * kern/powerpc/ieee1275/openfw.c: Likewise.
    * kern/sparc64/cache.S: Likewise.
    * kern/sparc64/dl.c: Likewise.
    * kern/sparc64/ieee1275/init.c: Likewise.
    * kern/sparc64/ieee1275/openfw.c: Likewise.
    * loader/efi/chainloader.c: Likewise.
    * loader/efi/chainloader_normal.c: Likewise.
    * loader/i386/efi/linux.c: Likewise.
    * loader/i386/efi/linux_normal.c: Likewise.
    * loader/i386/pc/chainloader.c: Likewise.
    * loader/i386/pc/chainloader_normal.c: Likewise.
    * loader/i386/pc/linux.c: Likewise.
    * loader/i386/pc/linux_normal.c: Likewise.
    * loader/i386/pc/multiboot.c: Likewise.
    * loader/i386/pc/multiboot_normal.c: Likewise.
    * loader/powerpc/ieee1275/linux.c: Likewise.
    * loader/powerpc/ieee1275/linux_normal.c: Likewise.
    * normal/arg.c: Likewise.
    * normal/cmdline.c: Likewise.
    * normal/command.c: Likewise.
    * normal/completion.c: Likewise.
    * normal/execute.c: Likewise.
    * normal/function.c: Likewise.
    * normal/lexer.c: Likewise.
    * normal/main.c: Likewise.
    * normal/menu.c: Likewise.
    * normal/menu_entry.c: Likewise.
    * normal/misc.c: Likewise.
    * normal/parser.y: Likewise.
    * normal/script.c: Likewise.
    * normal/i386/setjmp.S: Likewise.
    * normal/powerpc/setjmp.S: Likewise.
    * normal/sparc64/setjmp.S: Likewise.
    * partmap/acorn.c: Likewise.
    * partmap/amiga.c: Likewise.
    * partmap/apple.c: Likewise.
    * partmap/gpt.c: Likewise.
    * partmap/pc.c: Likewise.
    * partmap/sun.c: Likewise.
    * term/gfxterm.c: Likewise.
    * term/terminfo.c: Likewise.
    * term/efi/console.c: Likewise.
    * term/i386/pc/console.c: Likewise.
    * term/i386/pc/serial.c: Likewise.
    * term/i386/pc/vesafb.c: Likewise.
    * term/i386/pc/vga.c: Likewise.
    * term/ieee1275/ofconsole.c: Likewise.
    * util/biosdisk.c: Likewise.
    * util/console.c: Likewise.
    * util/genmoddep.c: Likewise.
    * util/getroot.c: Likewise.
    * util/grub-emu.c: Likewise.
    * util/grub-mkdevicemap.c: Likewise.
    * util/grub-probe.c: Likewise.
    * util/lvm.c: Likewise.
    * util/misc.c: Likewise.
    * util/raid.c: Likewise.
    * util/resolve.c: Likewise.
    * util/update-grub.in: Likewise.
    * util/update-grub_lib.in: Likewise.
    * util/grub.d/00_header.in: Likewise.
    * util/grub.d/10_hurd.in: Likewise.
    * util/grub.d/10_linux.in: Likewise.
    * util/i386/efi/grub-install.in: Likewise.
    * util/i386/efi/grub-mkimage.c: Likewise.
    * util/i386/pc/grub-install.in: Likewise.
    * util/i386/pc/grub-mkimage.c: Likewise.
    * util/i386/pc/grub-mkrescue.in: Likewise.
    * util/i386/pc/grub-setup.c: Likewise.
    * util/i386/pc/misc.c: Likewise.
    * util/powerpc/ieee1275/grub-install.in: Likewise.
    * util/powerpc/ieee1275/grub-mkimage.c: Likewise.
    * util/powerpc/ieee1275/misc.c: Likewise.
    * video/bitmap.c: Likewise.
    * video/video.c: Likewise.
    * video/i386/pc/vbe.c: Likewise.
    * video/i386/pc/vbeblit.c: Likewise.
    * video/i386/pc/vbefill.c: Likewise.
    * video/i386/pc/vbeutil.c: Likewise.
    * video/readers/tga.c: Likewise.
2007-07-21 23:32:33 +00:00
okuji d976fc51e1 2006-10-28 Yoshinori K. Okuji <okuji@enbug.org>
* normal/menu.c: Include grub/script.h.
        * normal/menu_entry.c: Likewise.
        * include/grub/normal.h: Do not include grub/script.h.
2006-10-28 14:00:05 +00:00
okuji 89a7d726f9 2006-05-27 Yoshinori K. Okuji <okuji@enbug.org>
* commands/blocklist.c: New file.

        * DISTLIST: Added commands/blocklist.c.

        * term/efi/console.c (grub_console_highlight_color): Use a lighter
        color for the background, and a daker color for the foreground.
        (grub_console_checkkey): Return READ_KEY.
        (grub_console_cls): Set the background to
        GRUB_EFI_BACKGROUND_BLACK temporarily to clean out the screen.

        * kern/efi/efi.c (grub_efi_exit_boot_services): New function.

        * include/grub/i386/linux.h (struct linux_kernel_params): Fixed
        the size of "padding5", "hd0_drive_info" and "hd1_drive_info".

        * include/grub/efi/efi.h (grub_efi_exit_boot_services): New
        prototype.

        * include/grub/efi/api.h (GRUB_EFI_TEXT_ATTR): Do not shift
        BG. The spec is wrong again.

        * include/grub/normal.h [GRUB_UTIL] (grub_blocklist_init): New
        prototype.
        [GRUB_UTIL] (grub_blocklist_fini): Likewise.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Added
        commands/blocklist.c.
        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.

        * conf/common.rmk (pkgdata_MODULES): Added blocklist.mod.
        (blocklist_mod_SOURCES): New variable.
        (blocklist_mod_CFLAGS): Likewise.
        (blocklist_mod_LDFLAGS): Likewise.
2006-05-27 21:09:25 +00:00
okuji 4e93851c0f 2006-05-07 Yoshinori K. Okuji <okuji@enbug.org>
Use the environment context in the menu. Remove the commands
        "default" and "timeout", and use variables instead.

        * normal/menu.c: Include grub/env.h.
        (print_entry): Cast TITLE to silence gcc.
        (get_timeout): New function.
        (set_timeout): Likewise.
        (get_entry_number): Likewise.
        (run_menu): Use a default entry, a fallback entry and a timeout
        in the environment variables "default", "fallback" and
        "timeout". Also, tweak the default entry if it is not within the
        current menu entries.
        (grub_menu_run): Use a fallback entry in the environment variable
        "fallback".

        * normal/main.c (read_config_file): Do not initialize
        NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or
        NEWMENU->TIMEOUT.
        (grub_normal_execute): Use a data slot to store the menu.

        * include/grub/normal.h (struct grub_menu): Removed default_entry,
        fallback_entry and timeout.
        (struct grub_menu_list): Removed.
        (grub_menu_list_t): Likewise.
        (struct grub_context): Likewise.
        (grub_context_t): Likewise.
        (grub_context_get): Likewise.
        (grub_context_get_current_menu): Likewise.
        (grub_context_push_menu): Likewise.
        (grub_context_pop_menu): Likewise.
        (grub_default_init): Likewise.
        (grub_default_fini): Likewise.
        (grub_timeout_init): Likewise.
        (grub_timeout_fini): Likewise.

        * conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod
        and timeout.mod.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed
        commands/default.c, commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c,
        commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/i386-efi.rmk (grub_emu_SOURCES): Removed
        commands/default.c, commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/common.rmk (pkgdata_MODULES): Removed default.mod and
        timeout.mod.
        (default_mod_SOURCES): Removed.
        (default_mod_CFLAGS): Likewise.
        (default_mod_LDFLAGS): Likewise.
        (timeout_mod_SOURCES): Removed.
        (timeout_mod_CFLAGS): Likewise.
        (timeout_mod_LDFLAGS): Likewise.

        * DISTLIST: Removed commands/default.c, commands/timeout.c and
        normal/context.c.

        * commands/default.c: Removed.
        * commands/timeout.c: Likewise.
        * normal/context.c: Likewise.
2006-05-07 18:28:24 +00:00
marco_g 77c4a3939d 2006-01-17 Marco Gerards <marco@gnu.org>
* include/grub/normal.h: Include <grub/script.h>.
	(grub_command_list): Removed struct.
	(grub_command_list_t): Removed type.
	(grub_menu_entry): Remove members `num' and `command_list'.  Add
	members `commands' and `sourcecode'.
	* include/grub/script.h: Add inclusion guards.
	(grub_script_cmd_menuentry): New struct.
	(grub_script_execute_menuentry): New prototype.
	(grub_script_lexer_record_start): Likewise.
	(grub_script_lexer_record_stop): Likewise.
	* normal/execute.c (grub_script_execute_menuentry): New function.
	* normal/lexer.c (record, recording, recordpos, recordlen): New
	variables.
	(grub_script_lexer_record_start): New function.
	(grub_script_lexer_record_stop): Likewise.
	(recordchar): Likewise.
	(nextchar): Likewise.
	(grub_script_yylex): Use `nextchar' to fetch new characters.  Use
	2048 as the buffer size.  Add the tokens `menuentry' and `@'.
	* normal/main.c: Include <grub/parser.h> and <grub/script.h>
	(current_menu): New variable.
	(free_menu): Mainly rewritten.
	(grub_normal_menu_addentry): New function.
	(read_config_file): Rewritten.
	* normal/menu.c (run_menu_entry): Mainly rewritten.
	* normal/menu_entry.c (make_screen): Rewritten te code to insert
	the menu entry.
	(run): Mainly rewritten.
	* normal/parser.y (menu_entry): New variable.
	(GRUB_PARSER_TOKEN_MENUENTRY): New token.
	(menuentry): New rule.
	(command): Add `menuentry'.
	(if_statement): Allow additional returns before `fi'.
	* normal/script.c (grub_script_create_cmdmenu): New function.
2006-01-17 09:50:47 +00:00
marco_g daac212ae3 2005-11-06 Marco Gerards <mgerards@xs4all.nl>
Add initial scripting support.

	* commands/test.c: New file.
	* include/grub/script.h: Likewise.
	* normal/execute.c: Likewise.
	* normal/function.c: Likewise.
	* normal/lexer.c: Likewise.
	* normal/parser.y: Likewise.
	* normal/script.c: Likewise.

	* configure.ac: Add `AC_PROG_YACC' test.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `commands/test.c',
	`normal/execute.c', `normal/lexer.c', `grub_script.tab.c',
	`normal/function.c' and `normal/script.c'.
	(normal_mod_SOURCES): `normal/execute.c', `normal/lexer.c',
	`grub_script.tab.c', `normal/function.c' and `normal/script.c'.
	(test_mod_SOURCES, test_mod_CFLAGS, test_mod_LDFLAGS): New variables.
	(pkgdata_MODULES): Add `test.mod'.
	(grub_script.tab.c): New rule.
	(grub_script.tab.h): Likewise.

	* include/grub/err.h (grub_err_t): Add `GRUB_ERR_TEST_FAILURE'.

	* include/grub/normal.h (grub_test_init): New prototype.
	(grub_test_fini): Likewise.

	* normal/command.c: Include <grub/script.h>.
	(grub_command_execute): Rewritten.

	* util/grub-emu.c (main): Call `grub_test_init' and
	`grub_test_fini'.
2005-11-06 22:19:59 +00:00
marco_g 67f44c8687 2005-08-28 Marco Gerards <metgerards@student.han.nl>
* include/grub/normal.h (enum grub_completion_type): Added
	`GRUB_COMPLETION_TYPE_ARGUMENT'.

	* normal/cmdline.c (print_completion): Handle
	the `GRUB_COMPLETION_TYPE_ARGUMENT' type.
	* normal/menu_entry.c (store_completion): Likewise.

	* normal/completion.c (complete_arguments): New function.
	(grub_normal_do_completion): Call `complete_arguments' when the
	current words start with a dash.
2005-08-28 17:01:16 +00:00
okuji 6a85ce7953 2005-08-20 Yoshinori K. Okuji <okuji@enbug.org>
* partmap/pc.c (pc_partition_map_iterate): Include the value of an
        invalid magic in thre error.

        * commands/search.c: New file.

        * util/grub-emu.c (main): Call grub_search_init and
        grub_search_fini.

        * kern/rescue.c (grub_rescue_print_disks): Removed.
        (grub_rescue_print_devices): New function.
        (grub_rescue_cmd_ls): Use grub_device_iterate with
        grub_rescue_print_devices instead of grub_disk_dev_iterate with
        grub_rescue_print_disks.

        * kern/partition.c (grub_partition_iterate): Return the result of
        PARTMAP->ITERATE instead of GRUB_ERRNO.

        * kern/device.c: Include grub/partition.h.
        (grub_device_iterate): New function.

        * include/grub/partition.h (grub_partition_iterate): Return int
        instead of grub_err_t.

        * include/grub/normal.h [GRUB_UTIL] (grub_search_init): New
        prototype.
        [GRUB_UTIL] (grub_search_fini): Likewise.

        * include/grub/device.h (grub_device_iterate): New prototype.

        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
        commands/search.c.
        (pkgdata_MODULES): Added search.mod.
        (search_mod_SOURCES): New variable.
        (search_mod_CFLAGS): Likewise.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/search.c.
        (pkgdata_MODULES): Added search.mod.
        (search_mod_SOURCES): New variable.
        (search_mod_CFLAGS): Likewise.

        * commands/ls.c (grub_ls_list_disks): Renamed to ...
        (grub_ls_list_devices): ... this, and use grub_device_iterate.
        All callers changed.

        * DISTLIST: Added commands/search.c.
2005-08-20 07:49:02 +00:00
okuji 992ffbbebb 2005-08-18 Yoshinori K. Okuji <okuji@enbug.org>
* normal/misc.c: New file.

        * DISTLIST: Added normal/misc.c.

        * partmap/amiga.c (amiga_partition_map_iterate): Add an argument
        DISK to HOOK. Call HOOK with DISK.
        * partmap/apple.c (apple_partition_map_iterate): Likewise.
        * partmap/pc.c (pc_partition_map_iterate): Likewise.
        * partmap/sun.c (sun_partition_map_iterate): Likewise.

        * normal/menu_entry.c (struct screen): Added a new member
        "completion_shown".
        (completion_buffer): New global variable.
        (make_screen): Set SCREEN->COMPLETION_SHOWN to zero.
        (store_completion): New function.
        (complete): Likewise.
        (clear_completions): Likewise.
        (grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero,
        call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is
        a tab, call complete.

        * normal/completion.c (disk_dev): Removed.
        (print_simple_completion): Likewise.
        (print_partition_completion): Likewise.
        (print_func): New global variable.
        (add_completion): Do not take the arguments WHAT or PRINT any
        longer. Added a new argument TYPE. Instead of printing directly,
        call PRINT_FUNC if not NULL.
        All callers changed.
        (complete_device): Use a local variable DEV instead of
        DISK_DEV. Do not move CURRENT_WORD to the end of a device name.
        (grub_normal_do_completion): Take a new argument HOOK. Do not
        initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an
        empty string, return NULL instead.
        All callers changed.

        * normal/cmdline.c (print_completion): New function.

        * kern/partition.c (grub_partition_iterate): Add an argument DISK
        to HOOK.
        All callers changed.

        * kern/disk.c (grub_print_partinfo): Removed.

        * include/grub/partition.h (struct grub_partition_map): Add a new
        argument DISK into HOOK of ITERATE.
        (grub_partition_iterate): Add a new argument DISK to HOOK.

        * include/grub/normal.h (enum grub_completion_type): New enum.
        (grub_completion_type_t): New type.
        (GRUB_COMPLETION_TYPE_COMMAND): New constant.
        (GRUB_COMPLETION_TYPE_DEVICE): Likewise.
        (GRUB_COMPLETION_TYPE_PARTITION): Likewise.
        (GRUB_COMPLETION_TYPE_FILE): Likewise.
        (grub_normal_do_completion): Added a new argument HOOK.
        (grub_normal_print_device_info): New prototype.

        * include/grub/disk.h (grub_print_partinfo): Removed.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c.
        (normal_mod_SOURCES): Likewise.
        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
        (normal_mod_SOURCES): Likewise.

        * commands/ls.c (grub_ls_list_disks): Use
        grub_normal_print_device_info instead of grub_print_partinfo. Free
        PNAME.
        (grub_ls_list_files): Use grub_normal_print_device_info instead of
        duplicating the code.
2005-08-18 03:14:39 +00:00
okuji 0a74e62fde 2005-08-14 Yoshinori K. Okuji <okuji@enbug.org>
* normal/menu.c (run_menu_entry):

        * normal/command.c (grub_command_execute): If INTERACTIVE is
        false and GRUB_COMMAND_FLAG_NO_ECHO is not specified, print
        CMDLINE. Disable the pager if INTERACTIVE is true.
        All callers are changed.

        * normal/main.c (grub_normal_execute): Read command.lst and fs.lst
        before reading a config file.
        * normal/main.c (read_config_file): Even if a command is not
        found, register it if it is within an entry.

        * util/grub-emu.c: Include sys/types.h and unistd.h.
        (options): Added --hold.
        (struct arguments): Added a new member "hold".
        (parse_opt): If KEY is 'H', set ARGS->HOLD to ARG or -1 if ARG is
        missing.
        (main): Initialize ARGS.HOLD to zero. Wait until ARGS.HOLD is
        cleared by a debugger, if it is not zero.

        * include/grub/normal.h (grub_command_execute): Add an argument
        INTERACTIVE.
2005-08-14 19:36:55 +00:00
okuji 8de3495c7b 2005-08-12 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added normal/completion.c.

        * normal/completion.c: New file.

        * term/i386/pc/console.c (grub_console_getwh): New function.
        (grub_console_term): Assign grub_console_getwh to getwh.

        * normal/cmdline.c (grub_tab_complete): Removed. Now the same
        function is defined in normal/completion.c as
        grub_normal_do_completion.
        (grub_cmdline_get): Use grub_normal_do_completion instead of
        grub_tab_complete.

        * kern/partition.c (grub_partition_map_iterate): Return 1 if HOOK
        returns non-zero, otherwise return 0.
        (grub_partition_iterate): First, probe the partition map. Then,
        call ITERATE only for this partition map.

        * kern/misc.c (grub_strncmp): Rewritten.

        * kern/disk.c (grub_disk_dev_iterate): Return 1 if P->ITERATE
        returns non-zero. Otherwise return 0.

        * include/grub/partition.h (grub_partition_map_iterate): Return
        int instead of void.

        * include/grub/normal.h (grub_normal_do_completion): New prototype.

        * include/grub/misc.h (grub_strncmp): Change the type of N to
        grub_size_t.

        * include/grub/disk.h (grub_disk_dev_iterate): Return int instead
        of void.

        * normal/menu.c (draw_border): Cast GRUB_TERM_BORDER_WIDTH to
        unsigned explictly before comparing it with I.

        * kern/main.c (grub_env_write_root): Add the attribute unused into
        VAR.

        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
        normal/completion.c.
        (normal_mod_SOURCES): Likewise.
        * conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
        (normal_mod_SOURCES): Likewise.

        * normal/command.c (grub_iterate_commands): If ITERATE returns
        non-zero, return one immediately.
2005-08-12 19:53:33 +00:00
okuji 39c9d41d2a 2005-07-03 Yoshinori Okuji <okuji@enbug.org>
* DISTLIST: Added genfslist.sh.

	* normal/main.c (fs_module_list): New variable.
	(autoload_fs_module): New function.
	(read_fs_list): Likewise.
	(grub_normal_execute): Call read_fs_list.

	* kern/fs.c (grub_fs_autoload_hook): New variable.
	(grub_fs_probe): Added support for auto-loading.

	* include/grub/normal.h (struct grub_fs_module_list): New struct.
	(grub_fs_module_list_t): New type.

	* include/grub/fs.h (grub_fs_autoload_hook_t): New type.
	(grub_fs_autoload_hook): New prototype.

	* genfslist.sh: New file.

	* genmk.rb: Added a rule to generate a filesystem list.
2005-07-03 18:06:56 +00:00
okuji 5822ff87a2 2005-03-08 Yoshinori Okuji <okuji@enbug.org>
Automatic loading of commands is supported.

  * normal/main.c (read_command_list): New function.
  (grub_normal_execute): Call read_command_list.

  * normal/command.c (grub_register_command): Return zero or CMD.
  Allocate CMD->NAME from the heap.
  Initialize CMD->MODULE_NAME to zero.
  Find the same name as well. If the same command is found and it is
  a dummy command, overwrite members. If it is not a dummy command,
  return zero.
  (grub_unregister_command): Free Q->NAME and Q->MODULE_NAME.
  (grub_command_find): If a dummy command is found, load a module
  and retry to find a command only once.

  * normal/cmdline.c (grub_tab_complete): Call grub_command_find to
  make sure that each command is loaded.

  * include/grub/normal.h (GRUB_COMMAND_FLAG_NOT_LOADED): New
  macro.
  (struct grub_command): Remove const from the member `name'.
  Add a new member `module_name'.
  (grub_register_command): Return grub_command_t.

  * commands/help.c (grub_cmd_help): Call grub_command_find to make
  sure that each command is loaded.

  * genmk.rb (PModule::rule): Specify a module name without the
  suffix ".mod" to gencmdlist.sh.
2005-03-08 01:01:06 +00:00
okuji 062aaf39bc 2005-03-02 Yoshinori K. Okuji <okuji@enbug.org>
* term/i386/pc/vga.c (debug_command): Removed.
  (GRUB_MOD_INIT): Do not register the command "debug".

  From Hollis Blanchard:
  * commands/configfile.c: New file.
  * conf/i386-pc.rmk (grub_emu_SOURCES): Added
  commands/configfile.c.
  (pkgdata_MODULES): Added configfile.mod.
  (configfile_mod_SOURCES): New variable.
  (configfile_mod_CFLAGS): Likewise.
  * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
  commands/configfile.c.
  (pkgdata_MODULES): Added configfile.mod.
  (configfile_mod_SOURCES): New variable.
  (configfile_mod_CFLAGS): Likewise.
  * util/grub-emu.c (main): Call grub_configfile_init and
  grub_configfile_fini.
  * include/grub/normal.h [GRUB_UTIL] (grub_configfile_init): New
  prototype.
  [GRUB_UTIL] (grub_configfile_fini): Likewise.
2005-03-02 20:12:46 +00:00
okuji 93f3a1d868 2005-02-27 Yoshinori K. Okuji <okuji@enbug.org>
* commands/default.h: New file.
  * commands/timeout.h: Likewise.
  * normal/context.c: Likewise.

  * util/misc.c: Do not include sys/times.h.
  Include sys/time.h and grub/machine/time.h.
  (grub_get_rtc): Rewritten with gettimeofday.

  * util/grub-emu.c (main): Call grub_default_init and
  grub_timeout_init before grub_normal_init, and call
  grub_timeout_fini and grub_default_fini after grub_main.

  * util/console.c (grub_ncurses_checkkey): Return the read
  character or -1.

  * normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it
  timeouts.

  * normal/main.c (read_config_file): Push MENU. If this fails,
  print an error and wait for a user input.
  Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE.
  If a menu is empty or an error occurs, pop MENU.
  (grub_normal_execute): Pop and free MENU after grub_menu_run
  returns.

  * kern/loader.c (grub_loader_boot): Call grub_machine_fini.

  * include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not
  include time.h.
  [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
  without GRUB_UTIL.
  * include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include
  time.h.
  [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as
  without GRUB_UTIL.

  * include/grub/normal.h (struct grub_menu_list): New struct.
  (grub_menu_list_t): New type.
  (struct grub_context): New struct.
  (grub_context_t): New type.
  (grub_register_command): Got rid of EXPORT_FUNC.
  (grub_unregister_command): Likewise.
  (grub_context_get): New prototype.
  (grub_context_get_current_menu): Likewise.
  (grub_context_push_menu): Likewise.
  (grub_context_pop_menu): Likewise.
  [GRUB_UTIL] (grub_default_init): Likewise.
  [GRUB_UTIL] (grub_default_fini): Likewise.
  [GRUB_UTIL] (grub_timeout_init): Likewise.
  [GRUB_UTIL] (grub_timeout_fini): Likewise.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c,
  commands/timeout.c and normal/context.c.
  (pkgdata_MODULES): Added default.mod and timeout.mod.
  (normal_mod_SOURCES): Added normal/context.c.
  (default_mod_SOURCES): New variable.
  (default_mod_CFLAGS): Likewise.
  (timeout_mod_SOURCES): Likewise.
  (timeout_mod_CFLAGS): Likewise.
  * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from
  conf/i386-pc.rmk.
  (pkgdata_MODULES): Added default.mod and timeout.mod.
  (normal_mod_SOURCES): Added normal/context.c.
  (default_mod_SOURCES): New variable.
  (default_mod_CFLAGS): Likewise.
  (timeout_mod_SOURCES): Likewise.
  (timeout_mod_CFLAGS): Likewise.

  * Makefile.in (all-local): Added $(MKFILES).
2005-02-27 21:19:06 +00:00
okuji 4d4e372ebd 2005-02-19 Yoshinori K. Okuji <okuji@enbug.org>
This implements an Emacs-like menu entry editor.

  * normal/menu_entry.c: New file.

  * util/console.c (grub_ncurses_putchar): Translate some Unicode
  characters to ASCII.
  (saved_char): New variable.
  (grub_ncurses_checkkey): Rewritten completely.
  (grub_ncurses_getkey): Likewise.
  (grub_ncurses_init): Call raw instead of cbreak.

  * normal/menu.c (print_entry): Do not put a space.
  (init_page): Renamed to ...
  (grub_menu_init_page): ... this. All callers changed.
  (edit_menu_entry): Removed.
  (run_menu): Call grub_menu_entry_run instead of edit_menu_entry.

  * normal/cmdline.c (grub_cmdline_run): Call grub_setcursor.

  * kern/misc.c (grub_vprintf): Call grub_refresh.

  * normal/menu.c (DISP_LEFT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_LEFT): ... this.
  * normal/menu.c (DISP_UP): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_UP): ... this.
  * normal/menu.c (DISP_RIGHT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_RIGHT): ... this.
  * normal/menu.c (DISP_DOWN): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_DOWN): ... this.
  * normal/menu.c (DISP_HLINE): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_HLINE): ... this.
  * normal/menu.c (DISP_VLINE): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_VLINE): ... this.
  * normal/menu.c (DISP_UL): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_UL): ... this.
  * normal/menu.c (DISP_UR): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_UR): ... this.
  * normal/menu.c (DISP_LL): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_LL): ... this.
  * normal/menu.c (DISP_LR): Renamed to ...
  * include/grub/term.h (GRUB_TERM_DISP_LR): ... this.
  * normal/menu.c (TERM_WIDTH): Renamed to ...
  * include/grub/term.h (GRUB_TERM_WIDTH): ... this.
  * normal/menu.c (TERM_HEIGHT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_HEIGHT): ... this.
  * normal/menu.c (TERM_INFO_HEIGHT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_INFO_HEIGHT): ... this.
  * normal/menu.c (TERM_MARGIN): Renamed to ...
  * include/grub/term.h (GRUB_TERM_MARGIN): ... this.
  * normal/menu.c (TERM_SCROLL_WIDTH): Renamed to ...
  * include/grub/term.h (GRUB_TERM_SCROLL_WIDTH): ... this.
  * normal/menu.c (TERM_TOP_BORDER_Y): Renamed to ...
  * include/grub/term.h (GRUB_TERM_TOP_BORDER_Y): ... this.
  * normal/menu.c (TERM_LEFT_BORDER_X): Renamed to ...
  * include/grub/term.h (GRUB_TERM_LEFT_BORDER_X): ... this.
  * normal/menu.c (TERM_BORDER_WIDTH): Renamed to ...
  * include/grub/term.h (GRUB_TERM_BORDER_WIDTH): ... this.
  * normal/menu.c (TERM_MESSAGE_HEIGHT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_MESSAGE_HEIGHT): ... this.
  * normal/menu.c (TERM_BORDER_HEIGHT): Renamed to ...
  * include/grub/term.h (GRUB_TERM_BORDER_HEIGHT): ... this.
  * normal/menu.c (TERM_NUM_ENTRIES): Renamed to ...
  * include/grub/term.h (GRUB_TERM_NUM_ENTRIES): ... this.
  * normal/menu.c (TERM_FIRST_ENTRY_Y): Renamed to ...
  * include/grub/term.h (GRUB_TERM_FIRST_ENTRY_Y): ... this.
  * normal/menu.c (TERM_ENTRY_WIDTH): Renamed to ...
  * include/grub/term.h (GRUB_TERM_ENTRY_WIDTH): ... this.
  * normal/menu.c (TERM_CURSOR_X): Renamed to ...
  * include/grub/term.h (GRUB_TERM_CURSOR_X): ... this.
  All callers changed.

  * include/grub/normal.h: New prototype.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added
  normal/menu_entry.c.
  (normal_mod_SOURCES): Likewise.
  * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
  (normal_mod_SOURCES): Likewise.

2005-02-15  Yoshinori K. Okuji  <okuji@enbug.org>

  * include/grub/normal.h (grub_halt_init): New prototype.
  (grub_halt_fini): Likewise.
  (grub_reboot_init): Likewise.
  (grub_reboot_fini): Likewise.

  * util/grub-emu.c: Include signal.h.
  (main_env): New global variable.
  (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot
  catch C-c.
  (grub_machine_fini): New function.
  (main): Call grub_halt_init and grub_reboot_init before
  grub_main, and grub_reboot_fini and grub_halt_fini after it.
  Call setjmp with MAIN_ENV to go back afterwards.
  Call grub_machine_fini right before return.

  * include/grub/util/misc.h: Include setjmp.h.
  (main_env): New prototype.

  * include/grub/kernel.h (grub_machine_fini): New prototype.
  * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise.
  * include/grub/i386/pc/console.h (grub_console_fini): Likewise.

  * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function.
  * kern/i386/pc/init.c (grub_machine_fini): Likewise.
  * term/i386/pc/console.c (grub_console_fini): Likewise.

  * util/i386/pc/misc.c: New file.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added
  util/i386/pc/misc.c, commands/i386/pc/halt.c and
  commands/i386/pc/reboot.c.
2005-02-19 20:56:07 +00:00
okuji e6b92c8afb 2005-02-15 Yoshinori K. Okuji <okuji@enbug.org>
* include/grub/normal.h (grub_halt_init): New prototype.
  (grub_halt_fini): Likewise.
  (grub_reboot_init): Likewise.
  (grub_reboot_fini): Likewise.

  * util/grub-emu.c: Include signal.h.
  (main_env): New global variable.
  (grub_machine_init): Ignore SIGINT. Otherwise grub-emu cannot
  catch C-c.
  (grub_machine_fini): New function.
  (main): Call grub_halt_init and grub_reboot_init before
  grub_main, and grub_reboot_fini and grub_halt_fini after it.
  Call setjmp with MAIN_ENV to go back afterwards.
  Call grub_machine_fini right before return.

  * include/grub/util/misc.h: Include setjmp.h.
  (main_env): New prototype.

  * include/grub/kernel.h (grub_machine_fini): New prototype.
  * include/grub/i386/pc/biosdisk.h (grub_biosdisk_fini): Likewise.
  * include/grub/i386/pc/console.h (grub_console_fini): Likewise.

  * disk/i386/pc/biosdisk.c (grub_biosdisk_fini): New function.
  * kern/i386/pc/init.c (grub_machine_fini): Likewise.
  * term/i386/pc/console.c (grub_console_fini): Likewise.

  * util/i386/pc/misc.c: New file.

  * conf/i386-pc.rmk (grub_emu_SOURCES): Added
  util/i386/pc/misc.c, commands/i386/pc/halt.c and
  commands/i386/pc/reboot.c.
2005-02-15 00:07:01 +00:00
marco_g 990cf3aa8a 2005-01-31 Marco Gerards <metgerards@student.han.nl>
* commands/help.c: New file.
	* normal/arg.c (show_help): Renamed to...
	(grub_arg_show_help): ... this.
	* commands/i386/pc/halt.c: New file.
	* commands/i386/pc/reboot.c: Likewise.
	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `commands/help.c'.
	(pkgdata_MODULES): Add `reboot.mod', `halt.mod' and `help.mod'.
	(help_mod_SOURCES, help_mod_CFLAGS, reboot_mod_SOURCES)
	(reboot_mod_CFLAGS, halt_mod_SOURCES, halt_mod_CFLAGS): New
	variables.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add
	`commands/help.c'.
	(pkgdata_MODULES): Add `help.mod'.
	(help_mod_SOURCES, help_mod_CFLAGS): New variables.
	* grub/i386/pc/init.h (grub_reboot): New prototype.
	(grub_halt): Likewise.
	* include/grub/normal.h (grub_arg_show_help): New prototype.
	(grub_help_init): Likewise.
	(grub_help_fini): Likewise.
	* util/grub-emu.c (main): Initialize and deinitialize the help
	command.

	* normal/cmdline.c (grub_cmdline_get): Doc fix.

	* normal/command.c (grub_command_init): Fixed the description of
	the `set' and `unset' commands.
2005-01-31 21:40:25 +00:00
marco_g 67bbaf0f38 2005-01-21 Marco Gerards <metgerards@student.han.nl>
Add the loopback device, a device via which files can be accessed
	as devices.

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add `disk/loopback.c'.
	(pkgdata_MODULES): Add loopback.mod.
	(loopback_mod_SOURCES): New variable.
	(loopback_mod_CFLAGS): Likewise.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add
	`disk/loopback.c'.
	(pkgdata_MODULES): Add loopback.mod.
	(loopback_mod_SOURCES): New variable.
	(loopback_mod_CFLAGS): Likewise.
	* disk/loopback.c: new file.
	* include/grub/normal.h (grub_loop_init): New prototype.
	(grub_loop_fini): New prototype.
	* util/grub-emu.c (main): Initialize and de-initialize loopback
	support.
	* include/grub/disk.h (grub_disk_dev_id): Add
	`GRUB_DISK_DEVICE_LOOPBACK_ID'.
2005-01-21 21:32:03 +00:00
marco_g b47efe305a 2004-09-17 Marco Gerards <metgerards@student.han.nl>
Add `linux.mod' and `multiboot.mod' so linux and multiboot kernels
	can be loaded from normal mode.

	* conf/i386-pc.rmk (pkgdata_MODULES): Add `linux.mod' and
	`multiboot.mod'.
	(linux_mod_SOURCES, linux_mod_CFLAGS, multiboot_mod_SOURCES)
	(multiboot_mod_CFLAGS): New variables.
	* loader/i386/pc/linux_normal.c: New file.
	* loader/i386/pc/multiboot_normal.c: Likewise.

	* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Don't use the
	attribute `unused'.

	* fs/ext2.c (grub_ext2_iterate_dir): Fix typos in inode type.  Use
	`fdiro' to read the mode information from instead of `diro'.

	* fs/fshelp.c (grub_fshelp_find_file): Set type to foundtype after
	looking up a symlink.

	* include/grub/normal.h (GRUB_COMMAND_FLAG_NO_ARG_PARSE): New
	macro.
	* normal/command.c (grub_command_execute): Don't parse the
	arguments when `GRUB_COMMAND_FLAG_NO_ARG_PARSE' is set in the
	flags of the command.

	* normal/menu.c (grub_menu_run): Fix typo.
2004-09-17 09:36:52 +00:00
okuji 3c52136a94 2004-09-10 Yoshinori K. Okuji <okuji@enbug.org>
* normal/menu.c: Include grub/loader.h and grub/machine/time.h.
  (print_message): Add a missing newline.
  (run_menu): Added timeout support.
  (run_menu_entry): New local function.
  (grub_menu_run): Added support for booting.

  * kern/loader.c (grub_loader_is_loaded): New function.

  * include/grub/powerpc/ieee1275/time.h: Include grub/symbol.h.
  (grub_get_rtc): Exported.

  * include/grub/i386/pc/time.h: Include grub/symbol.h.
  (grub_get_rtc): Exported.

  * include/grub/normal.h (struct grub_command_list): Remove
  constant from the member `command'.

  * include/grub/loader.h (grub_loader_is_loaded): Declared.

  * include/grub/err.h (GRUB_ERR_INVALID_COMMAND): New constant.

  * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/time.h.
2004-09-10 20:31:55 +00:00
okuji 4b13b216f4 2004-04-04 Yoshinori K. Okuji <okuji@enbug.org>
All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_
	and grub_, respectively. Because the conversion is trivial and
	mechanical, I omit the details here. Please refer to the CVS
	if you need more information.
2004-04-04 13:46:03 +00:00
marco_g db1771cfbe 2004-03-14 Marco Gerards <metgerards@student.han.nl>
* commands/boot.c: New file.
	* commands/cat.c: Likewise.
	* commands/cmp.c: Likewise.
	* commands/ls.c: Likewise.
	* commands/terminal.c: Likewise.
	* normal/command.c: Include <pupa/env.h> and <pupa/dl.h>.
	(pupa_register_command): Changed interface to match the new
	argument parser.
	(pupa_command_execute): Changed (almost rewritten) so it uses
	pupa_split_command.  Added support for setting variables using the
	syntax `foo=bar'.
	(rescue_command): Changed to work with the new argument parser.
	(terminal_command): Moved from here to commands/terminal.c.
	(set_command): New function.
	(unset_command): New function.
	(insmod_command): New function.
	(rmmod_command): New function.
	(lsmod_command): New function.
	(pupa_command_init): Don't initialize the command terminal
	anymore.  Initialize the commands set, unset, insmod, rmmod and
	lsmod.
	* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/env.c.
	(kernel_img_HEADERS): Add arg.h and env.h.
	(pupa_mkimage_LDFLAGS): Add kern/env.c.
	(pupa_emu_SOURCES): Add kern/env.c, commands/ls.c,
	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c,
	normal/arg.c.
	(pkgdata_MODULES): Add ls.mod, boot.mod, cmp.mod, cat.mod and
	terminal.mod.
	(normal_mod_SOURCES): Add normal/arg.c and normal/arg.c.
	(boot_mod_SOURCES): New variable.
	(terminal_mod_SOURCES): Likewise.
	(ls_mod_SOURCES): Likewise.
	(cmp_mod_SOURCES): Likewise.
	(cat_mod_SOURCES): Likewise.

	* normal/arg.c: New file.
	* kern/env.c: Likewise.
	* include/pupa/arg.h: Likewise.
	* include/pupa/env.h: Likewise.
	* font/manager.c (font_command): Changed to match argument parsing
	interface changes.
	(PUPA_MOD_INIT): Likewise.
	* hello/hello.c (pupa_cmd_hello): Likewise.
	(PUPA_MOD_INIT): Likewise.
	* include/pupa/disk.h: Include <pupa/device.h>.
	(pupa_print_partinfo): New prototype.
	* include/pupa/dl.h (pupa_dl_set_prefix): Prototype removed.
	(pupa_dl_get_prefix): Likewise.
	* include/pupa/misc.h: Include <pupa/err.h>.
	(pupa_isgraph): New prototype.
	(pupa_isdigit): Likewise.
	(pupa_split_cmdline): Likewise.
	* include/pupa/normal.h: Include <pupa/arg.h>.
	(pupa_command): Changed the prototype of the member `func' to
	match the argument parsing interface.  Added member `options'.
	(pupa_register_command): Updated to match function.
	(pupa_arg_parse): New prototype.
	(pupa_hello_init) [PUPA_UTIL]: New prototype.
	(pupa_hello_fini) [PUPA_UTIL]: Likewise.
	(pupa_ls_init) [PUPA_UTIL]: Likewise.
	(pupa_ls_fini) [PUPA_UTIL]: Likewise.
	(pupa_cat_init) [PUPA_UTIL]: Likewise.
	(pupa_cat_fini) [PUPA_UTIL]: Likewise.
	(pupa_boot_init) [PUPA_UTIL]: Likewise.
	(pupa_boot_fini) [PUPA_UTIL]: Likewise.
	(pupa_cmp_init) [PUPA_UTIL]: Likewise.
	(pupa_cmp_fini) [PUPA_UTIL]: Likewise.
	(pupa_terminal_init) [PUPA_UTIL]: Likewise.
	(pupa_terminal_fini) [PUPA_UTIL]: Likewise.
	* kern/disk.c: Include <pupa/file.h>.
	(pupa_print_partinfo): New function.
	* kern/dl.c: Include <pupa/env.h>.
	(pupa_dl_dir): Variable removed.
	(pupa_dl_load): Use the environment variable `prefix' instead of
	the variable pupa_dl_dir.
	(pupa_dl_set_prefix): Function removed.
	(pupa_dl_get_prefix): Likewise.
	* kern/i386/pc/init.c: Include <pupa/env.h>.
	(pupa_machine_init): Use the environment variable `prefix' instead of
	using pupa_dl_set_prefix to set the prefix.
	* kern/main.c: Include <pupa/env.h>.
	(pupa_set_root_dev): Use the environment variable `prefix' instead of
	using pupa_dl_get_prefix to get the prefix.
	* kern/misc.c: Include <pupa/env.h>.
	(pupa_isdigit): New function.
	(pupa_isgraph): Likewise.
	(pupa_ftoa): Likewise.
	(pupa_vsprintf): Added support for printing values of the type
	`double'.  Make it possible to format variable output when using
	formatting like `%1.2%f'.
	(pupa_split_cmdline): New function.
	* kern/rescue.c: Include <pupa/env.h>.
	(next_word): Removed function.
	(pupa_rescue_cmd_prefix): Likewise.
	(pupa_rescue_cmd_set): New function.
	(pupa_rescue_cmd_unset): New function.
	(pupa_enter_rescue_mode): Use the `pupa_split_cmdline' function to
	split the command line instead of splitting it here.  Added
	support for setting variables using the syntax `foo=bar'.  Don't
	initialize the prefix command anymore.  Initialized the set and
	unset commands.
	* normal/cmdline.c: Include <pupa/env.h>.
	(pupa_tab_complete): Added prototypes for print_simple_completion,
	print_partition_completion, add_completion, iterate_commands,
	iterate_dev, iterate_part and iterate_dir. Moved code to print
	partition information from here to kern/disk.c.
	(pupa_cmdline_run): Don't check if the funtion exists anymore.
	* normal/main.c: Include <pupa/env.h>.
	(pupa_rescue_cmd_normal): Use the environment variable `prefix'
	instead of using pupa_dl_get_prefix to get the prefix.
	* term/i386/pc/vga.c: Include <pupa/arg.h>.
	(check_vga_mem): Cast pointers to `void *' to silence a gcc
	warning.
	(pupa_vga_putchar) [! DEBUG_VGA]: Removed for this case.
	(pupa_vga_setcolor): Declare unused variables with `__attribute__
	((unused))' to silence a gcc warning.
	(pupa_vga_setcolor): Likewise.
	(debug_command): Changed to match argument parsing
	interface changes.
	* util/pupa-emu.c: Include <pupa/env.h>.
	(options): Added 0's for unused fields to silence a gcc warning.
	(argp): Likewise.
	(main): Use the environment variable `prefix' instead of using
	pupa_dl_set_prefix to set the prefix.  Initialize the commands ls,
	boot, cmp, cat and terminal.  Finish the commands boot, cmp, cat
	and terminal.

	* util/i386/pc/getroot.c: Include <pupa/i386/pc/util/biosdisk.h>.
	* util/misc.c: Include <malloc.h>.
	(pupa_malloc): Rewritten so errors are correctly reported.
	(pupa_realloc): Likewise.
	(pupa_memalign): Likewise.
	(pupa_mm_init_region): Declare unused variables with
	`__attribute__ ((unused))' to silence a gcc warning.
	* normal/i386/setjmp.S: Remove tab at the end of the file to
	silence a gcc warning.
	* loader/i386/pc/linux.c (pupa_rescue_cmd_initrd): Declare unused
	variables with `__attribute__ ((unused))' to silence a gcc
	warning.
	* loader/i386/pc/multiboot.c (pupa_multiboot_unload): Make the
	local variable i unsigned to silence a gcc warning.

	* kern/term.c: Include <pupa/misc.h>.
	(pupa_more_lines): New variable.
	(pupa_more): Likewise.
	(pupa_putcode): When the pager is active pause at the end of every
	screen.
	(pupa_set_more): New function.
	* include/pupa/term.h (pupa_set_more): New prototype.
2004-03-13 13:59:25 +00:00
okuji 8367695cff shinori K. Okuji <okuji@enbug.org>
* genkernsyms.sh: Updated copyright information.
	* genmk.rb: Likewise.
	* genmodsrc.sh: Likewise.
	* gensymlist.sh: Likewise.
	* boot/i386/pc/boot.S: Likewise.
	* boot/i386/pc/diskboot.S: Likewise.
	* disk/i386/pc/biosdisk.c: Likewise.
	* disk/i386/pc/partition.c: Likewise.
	* font/manager.c: Likewise.
	* fs/ext2.c: Likewise.
	* fs/fat.c: Likewise.
	* include/pupa/boot.h: Likewise.
	* include/pupa/device.h: Likewise.
	* include/pupa/disk.h: Likewise.
	* include/pupa/dl.h: Likewise.
	* include/pupa/elf.h: Likewise.
	* include/pupa/err.h: Likewise.
	* include/pupa/file.h: Likewise.
	* include/pupa/font.h: Likewise.
	* include/pupa/fs.h: Likewise.
	* include/pupa/kernel.h: Likewise.
	* include/pupa/loader.h: Likewise.
	* include/pupa/misc.h: Likewise.
	* include/pupa/mm.h: Likewise.
	* include/pupa/net.h: Likewise.
	* include/pupa/normal.h: Likewise.
	* include/pupa/rescue.h: Likewise.
	* include/pupa/setjmp.h: Likewise.
	* include/pupa/symbol.h: Likewise.
	* include/pupa/term.h: Likewise.
	* include/pupa/types.h: Likewise.
	* include/pupa/i386/setjmp.h: Likewise.
	* include/pupa/i386/types.h: Likewise.
	* include/pupa/i386/pc/biosdisk.h: Likewise.
	* include/pupa/i386/pc/boot.h: Likewise.
	* include/pupa/i386/pc/console.h: Likewise.
	* include/pupa/i386/pc/init.h: Likewise.
	* include/pupa/i386/pc/kernel.h: Likewise.
	* include/pupa/i386/pc/linux.h: Likewise.
	* include/pupa/i386/pc/loader.h: Likewise.
	* include/pupa/i386/pc/memory.h: Likewise.
	* include/pupa/i386/pc/multiboot.h: Likewise.
	* include/pupa/i386/pc/partition.h: Likewise.
	* include/pupa/i386/pc/time.h: Likewise.
	* include/pupa/i386/pc/vga.h: Likewise.
	* include/pupa/i386/pc/util/biosdisk.h: Likewise.
	* include/pupa/util/getroot.h: Likewise.
	* include/pupa/util/misc.h: Likewise.
	* include/pupa/util/resolve.h: Likewise.
	* kern/device.c: Likewise.
	* kern/disk.c: Likewise.
	* kern/dl.c: Likewise.
	* kern/err.c: Likewise.
	* kern/file.c: Likewise.
	* kern/fs.c: Likewise.
	* kern/loader.c: Likewise.
	* kern/main.c: Likewise.
	* kern/misc.c: Likewise.
	* kern/mm.c: Likewise.
	* kern/rescue.c: Likewise.
	* kern/term.c: Likewise.
	* kern/i386/dl.c: Likewise.
	* kern/i386/pc/init.c: Likewise.
	* kern/i386/pc/lzo1x.S: Likewise.
	* kern/i386/pc/startup.S: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/i386/pc/multiboot.c: Likewise.
	* normal/cmdline.c: Likewise.
	* normal/command.c: Likewise.
	* normal/main.c: Likewise.
	* normal/menu.c: Likewise.
	* normal/i386/setjmp.S: Likewise.
	* term/i386/pc/console.c: Likewise.
	* term/i386/pc/vga.c: Likewise.
	* util/console.c: Likewise.
	* util/genmoddep.c: Likewise.
	* util/misc.c: Likewise.
	* util/pupa-emu.c: Likewise.
	* util/resolve.c: Likewise.
	* util/unifont2pff.rb: Likewise.
	* util/i386/pc/biosdisk.c: Likewise.
	* util/i386/pc/getroot.c: Likewise.
	* util/i386/pc/pupa-mkimage.c: Likewise.
	* util/i386/pc/pupa-setup.c: Likewise.
2004-02-24 17:21:53 +00:00