Commit Graph

26 Commits

Author SHA1 Message Date
okuji 970d3b8ab0 2006-04-21 Yoshinori K. Okuji <okuji@enbug.org>
* kern/misc.c (grub_lltoa): New function.
        (grub_vsprintf): Added support for the long long suffix,
        i.e. "ll".
2006-04-21 16:35:23 +00:00
okuji 25fe6f0349 2005-10-28 Yoshinori K. Okuji <okuji@enbug.org>
From Timothy Baldwin:
        * commands/ls.c (grub_ls_list_files): Close FILE with
        grub_file_close.
        * kern/misc.c (grub_vsprintf): Terminate the string S with NUL.
2005-10-28 03:14:33 +00:00
marco_g 04ccf3ec6f 2005-10-24 Marco Gerards <mgerards@xs4all.nl>
* include/grub/parser.h: New file.

	* kern/parser.c: Likewise.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/parser.c'.
	(grub_setup_SOURCES): Likewise.
	(grub_probefs_SOURCES): Likewise.
	(grub_emu_SOURCES): Likewise.
	(kernel_img_HEADERS): Add `parser.h'.

	* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
	(grub_emu_SOURCES): Add `kern/parser.c'.
	(grubof_SOURCES): Likewise.

	* conf/sparc64-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
	(grubof_SOURCES): Add `kern/parser.c'.

	* include/grub/misc.h (grub_split_cmdline): Removed prototype.

	* kern/misc.c (grub_split_cmdline): Removed function.

	* kern/rescue.c: Include <grub/parser.h>.
	(grub_enter_rescue_mode): Use `grub_parser_split_cmdline' instead
	of `grub_split_cmdline'.

	* normal/command.c: Include <grub/parser.h>.
	(grub_command_execute):  Use `grub_parser_split_cmdline' instead
	of `grub_split_cmdline'.

	* normal/completion.c: Include <grub/parser.h>.
	(cmdline_state): New variable.
	(iterate_dir): End the filename with a quote depending on the
	command line state.
	(get_state): new function.
	(grub_normal_do_completion): Use `grub_parser_split_cmdline' to
	split the arguments and determine the current argument.  When the
	argument string is not quoted, escape all spaces.
2005-10-24 10:23:46 +00:00
okuji 385c6a92a3 2005-08-21 Yoshinori K. Okuji <okuji@enbug.org>
* util/console.c (grub_ncurses_putchar): If C is greater than
        0x7f, set C to a question mark.
        (grub_ncurses_getcharwidth): New function.
        (grub_ncurses_term): Specify grub_ncurses_getcharwidth as
        getcharwidth.

        * normal/menu.c (print_entry): Made aware of Unicode. First,
        convert TITLE to UCS-4, and predict the cursor position by
        grub_getcharwidth.

        * include/grub/misc.h (grub_utf8_to_ucs4): Specify the qualifier
        const to SRC.
        * kern/misc.c (grub_utf16_to_utf8): Likewise.
2005-08-21 07:22:51 +00:00
okuji ef0954341c 2005-08-20 Yoshinori K. Okuji <okuji@enbug.org>
* kern/term.c (grub_putchar): Use grub_utf8_to_ucs4 for the
        conversion.
        (grub_getcharwidth): New function.

        * kern/misc.c (grub_utf8_to_ucs4): New function.

        * include/grub/term.h (struct grub_term): Added a new member
        "getcharwidth".
        (grub_getcharwidth): New prototype.

        * include/grub/misc.h (grub_utf8_to_ucs4): New prototype.

        * term/i386/pc/console.c (map_char): New function. Segregated from
        grub_console_putchar.
        (grub_console_putchar): Use map_char.
        (grub_console_getcharwidth): New function.
        (grub_console_term): Specified grub_console_getcharwidth as
        getcharwidth.

        * term/i386/pc/vga.c (grub_vga_getcharwidth): New function.
        (grub_vga_term): Specified grub_vga_getcharwidth as getcharwidth.

        * term/i386/pc/vesafb.c (grub_virtual_screen_setup): Return
        GRUB_ERRNO.
        (grub_vesafb_init): Do not use RC. Instead, use GRUB_ERRNO. Rely
        on grub_strtoul completely.
        (write_char): Declare local variables in the beginning of the
        function.
        (grub_vesafb_getcharwidth): New function.
        (grub_vesafb_term): Specified grub_vesafb_getcharwidth as
        getcharwidth.
2005-08-20 05:26:51 +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
hollisb e75d76e157 2005-06-23 Hollis Blanchard <hollis@penguinppc.org>
* kern/misc.c (grub_vsprintf): Add `longfmt'.  If format string
	contains `l' modifier, get a long from va_arg().
2005-06-23 23:13:57 +00:00
hollisb 708b345f74 2005-05-08 Vincent Pelletier <subdino2004@yahoo.fr>
* include/grub/misc.h (grub_dprintf): New macro.
	(grub_real_dprintf): New prototype.
	(grub_strword): Likewise.
	(grub_iswordseparator): Likewise.
	* kern/misc.c (grub_real_dprintf): New function.
	(grub_strword): Likewise.
	(grub_iswordseparator): Likewise.
2005-05-09 01:47:37 +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
marco_g e3741a2734 2005-01-22 Marco Gerards <metgerards@student.han.nl>
* kern/misc.c (grub_strndup): Function rewritten.
2005-01-22 15:58:18 +00:00
marco_g ad0bd20b79 2004-11-01 Marco Gerards <metgerards@student.han.nl>
Add support for iso9660 (including rockridge).

	* conf/i386-pc.rmk (grub_emu_SOURCES): Add fs/iso9660.c.
	(iso9660_mod_SOURCES): New variable.
	(iso9660_mod_CFLAGS): Likewise.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs/iso9660.c.
	* include/grub/fs.h (grub_iso9660_init): New prototype.
	* util/grub-emu.c (main): Call `grub_iso9660_init'.
	* fs/iso9660.c: New file.

	* include/grub/misc.h (grub_strncat): New prototype.
	* kern/misc.c (grub_strncat): New function.

	* fs/hfs.c (grub_hfs_mount): Translate the error
	`GRUB_ERR_OUT_OF_RANGE' to `GRUB_ERR_BAD_FS'.
	* fs/jfs.c (grub_jfs_mount): Likewise.
	* fs/ufs.c (grub_ufs_mount): Likewise.
2004-11-01 16:14:16 +00:00
okuji 062b24c22c 2004-09-14 Yoshinori K. Okuji <okuji@enbug.org>
From Hollis Blanchard <hollis@penguinppc.org>:
  * kern/misc.c (memmove): New alias for grub_memmove.
  (memcmp): New alias for grub_memcmp.
  (memset): New alias for grub_memset.
  * boot/powerpc/ieee1275/ieee1275.c (grub_ieee1275_get_property):
  Change "int handle" to "grub_ieee1275_phandle_t handle".
  * include/grub/powerpc/ieee1275/ieee1275.h
  (grub_ieee1275_get_property): Likewise.
2004-09-14 08:56:51 +00:00
marco_g aa0335603c 2004-08-28 Marco Gerards <metgerards@student.han.nl>
Add support for the JFS filesystem.

	* fs/jfs.c: New file.
	* include/grub/fs.h (grub_jfs_init): New prototype.
	(grub_jfs_fini): New prototype.
	* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/jfs.c.
	(grub_emu_SOURCES): Likewise.
	(pkgdata_MODULES): Add jfs.mod.
	(jfs_mod_SOURCES): New variable.
	(jfs_mod_CFLAGS): Likewise.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs.jfs.c.
	(grubof_SOURCES): Likewise.
	* util/grub-emu.c (main): Initialize and deinitialize JFS support.

	* fs/fat.c (grub_fat_find_dir): Convert the filename little
	endian to the host endian.
	(grub_fat_utf16_to_utf8): Move function from there...
	* kern/misc.c (grub_utf16_to_utf8): ...to here.  Do not convert
	the endianess of the source string anymore.
	* include/grub/misc.h (grub_utf16_to_utf8): New prototype.
2004-08-28 13:14:29 +00:00
marco_g 64372eb442 2004-08-18 Marco Gerards <metgerards@student.han.nl>
* fs/hfs.c: New file.
	* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/hfs.c.
	(grub_emu_SOURCES): Likewise.
	(pkgdata_MODULES): Add hfs.mod.
	* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add fs/hfs.c.
	(grubof_SOURCES): Likewise.
	* util/grub-emu.c (main): Initialize and deinitialize HFS support.

	* include/grub/misc.h (grub_strncasecmp): Add prototype.
	* kern/misc.c (grub_strncasecmp): Add function.
2004-08-18 09:00:01 +00:00
marco_g e15199cb7b 2004-07-11 Marco Gerards <metgerards@student.han.nl>
* disk/powerpc/ieee1275/partition.c (grub_partition_iterate): Skip
	one block instead of two when looking for the initial partition.
	(grub_partition_probe): Initialize the local variable `p' with 0.
	Use base 10 for the grub_strtoul call.
	* kern/misc.c (grub_strncpy): Fix off by one bug.  Eliminated the
	need for one local variable.
	(grub_strtoul): Don't add the new value to `num', instead of that
	just assign it.
2004-07-11 14:24:54 +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
jeroen 8c8cc20511 2004-03-14 Jeroen Dekkers <jeroen@dekkers.cx>
* Makefile.in: Update copyright.
	* genmodsrc.sh: Likewise.
	* gensymlist.sh: Likewise.
	* term/i386/pc/vga.c: Indent correctly.

	* util/i386/pc/pupa-mkimage.c (usage): Use PACKAGE_BUGREPORT as
	bugreporting address.
	* util/i386/pc/pupa-setup.c (usage): Likewise,
	(main): Call pupa_ext2_init and pupa_ext2_fini.

	* fs/fat.c (log2): Renamed to ...
	(fat_log2): ... this.
	All callers changed.
	* kern/misc.c (memcpy): Alias to pupa_memmove.
	* loader/i386/pc/multiboot.c (pupa_rescue_cmd_multiboot): Fix
	lvalue cast.
	* util/console.c (pupa_ncurses_fini): Return 0.

	* util/i386/pc/biosdisk.c (pupa_util_biosdisk_open)[__linux__]:
	Move fail label here.
	[__GNU__]: Don't warn when using stat.
	(open_device)[!__linux__]: Check if FD < 0 instead of !FD.
	(pupa_util_biosdisk_get_pupa_dev)[__GNU__]: Change type of N to
	long int. Use strtol instead of strtoul.
2004-03-14 17:48:25 +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
marco_g 5aded270b6 2003-12-03 Marco Gerards <metgerards@student.han.nl>
* fs/ext2.c (pupa_ext2_label): New function.
	(pupa_ext2_fs): Added label.
	* fs/fat.c (pupa_fat_label): New function.
	(pupa_fat_fs): Added label.
	* include/pupa/fs.h (struct pupa_fs): Added prototype label.

	* kern/misc.c (pupa_strndup): New function.
	* include/pupa/misc.h (pupa_strndup): New prototype.

	* include/pupa/normal.h: Include <pupa/err.h>.
	(pupa_set_history): New prototype.
	(pupa_iterate_commands): New prototype.
	* normal/cmdline.c: Include <pupa/machine/partition.h>,
	<pupa/disk.h>, <pupa/file.h>.
	(hist_size): New variable.
	(hist_lines): Likewise.
	(hist_end): Likewise.
	(hist_used): Likewise.
	(pupa_set_history): New function.
	(pupa_history_get): Likewise.
	(pupa_history_add): Likewise.
	(pupa_history_replace): Likewise.
	(pupa_tab_complete): Likewise.
	(pupa_cmdline_run): Added tab completion and history buffer.  Tab
	completion shows partitionnames while completing partitions, this
	feature was suggested by Jeff Bailey.
	* normal/command.c (pupa_iterate_commands): New function.
	* normal/main.c (PUPA_DEFAULT_HISTORY_SIZE): New macro.
	(pupa_normal_init): Initialize history buffer.
	(PUPA_MOD_INIT): Likewise.
	(pupa_normal_fini): Free the history buffer.
	(PUPA_MOD_FINI): Likewise.

	* util/console.c (pupa_ncurses_getkey): Accept 127 as backspace
	key.

	* aclocal.m4 (pupa_I386_CHECK_REGPARM_BUG): New DEFUN.
	* configure.ac [i386]: Check for regparam bug.
	(NESTED_FUNC_ATTR) [! i386]: Defined.
2003-12-03 19:17:27 +00:00
marco_g 1f7315a3de 2003-11-17 Marco Gerards <metgerards@student.han.nl>
* conf/i386-pc.rmk (sbin_UTILITIES): Added pupa-emu.
	(pupa_setup_SOURCES): Added util/i386/pc/getroot.c.
	(pupa_emu_SOURCES): New variable.
	(pupa_emu_LDFLAGS): Likewise.
	* include/pupa/fs.h (pupa_ext2_init) [PUPA_UTIL]: New prototype.
	(pupa_ext2_fini) [PUPA_UTIL]: Likewise.
	* include/pupa/normal.h (pupa_normal_init) [PUPA_UTIL]: Likewise.
	(pupa_normal_fini) [PUPA_UTIL]: Likewise.
	* include/pupa/setjmp.h [PUPA_UTIL]: Include <setjmp.h>.
	(pupa_jmp_buf): New typedef.
	(pupa_setjmp) [PUPA_UTIL]: New macro.
	(pupa_longjmp) [PUPA_UTIL]: Likewise.
	* include/pupa/term.h (struct pupa_term): New member `refresh'.
	(pupa_refresh): New prototype.
	* include/pupa/util/getroot.h: New file.
	* kern/misc.c (pupa_vsprintf): Refresh the screen after updating
	it.
	* kern/rescue.c (pupa_rescue_get_command_line): Likewise.
	(pupa_rescue_cmd_cat): Likewise.
	(pupa_rescue_cmd_ls): Likewise.
	(pupa_rescue_cmd_testload): Likewise.
	(pupa_rescue_cmd_lsmod): Likewise.
	* normal/cmdline.c (pupa_cmdline_get): Likewise.
	* normal/menu.c (run_menu): Likewise.
	* kern/term.c (pupa_cls): Likewise.
	(pupa_refresh): New function.
	* normal/normal.c (pupa_normal_init) [PUPA_UTIL]: New function.
	(pupa_normal_fini) [PUPA_UTIL]: Likewise.
	* util/console.c: New file.

	* util/i386/pc/getroot.c: New file.
	* util/i386/pc/pupa-setup.c: Include <pupa/util/getroot.h>.
	(pupa_putchar): New function.
	(pupa_refresh): Likewise.
	(xgetcwd): Function moved to ...
	(strip_extra_slashes): Likewise.
	(get_prefix): Likewise.
	* util/i386/pc/getroot.c: ... here.
	(find_root_device): Function moved and renamed to...
	* util/i386/pc/getroot.c (pupa_find_root_device): ... here.
	Changed all callers.
	* util/i386/pc/pupa-setup.c (guess_root_device): Function moved
	and renamed to...
	* util/i386/pc/getroot.c (pupa_guess_root_device): ... here.
	Changed all callers.
	* util/misc.c (pupa_memalign): New function.
	(pupa_mm_init_region): Likewise.
	(pupa_register_exported_symbols): Likewise.
	(pupa_putchar): Function removed.
	* util/pupa-emu.c: New file.
2003-11-17 18:07:09 +00:00
jeroen 9a5c1adeaa 2003-11-16 Jeroen Dekkers <jeroen@dekkers.cx>
* conf/i386-pc.rmk (pkgdata_MODULES): Add _multiboot.mod.
	(_multiboot_mod_SOURCES): New variable.
	(_multiboot_mod_CFLAGS): Likewise.
	* loader/i386/pc/multiboot.c: New file.
	* include/pupa/i386/pc/multiboot.h: Likewise.
	* kern/i386/pc/startup.S: Include pupa/machine/multiboot.h.
	(pupa_multiboot_real_boot): New function.
	* include/pupa/i386/pc/loader.h: Include pupa/machine/multiboot.h.
	(pupa_multiboot_real_boot): New prototype.
	(pupa_rescue_cmd_multiboot): Likewise
	(pupa_rescue_cmd_module): Likewise.

	* kern/loader.c (pupa_loader_set): Continue when
	pupa_loader_unload_func() fails.
	(pupa_loader_unset): New function.
	* include/pupa/loader.h (pupa_loader_unset): New prototype.

	* kern/misc.c (pupa_stpcpy): New function.
	* include/pupa/misc.h (pupa_stpcpy): New prototype.
2003-11-16 16:36:39 +00:00
marco_g a35eed7c3e 2003-10-27 Marco Gerards <metgerards@student.han.nl>
* README: In the pupa-mkimage example use _chain instead of chain
	and ext2 instead of fat.
	* TODO: Replace ext2fs with jfs as an example.  Add an item for
	adding journal playback for ext2fs.
	* conf/i386-pc.rmk (pupa_setup_SOURCES): Added fs/ext2.c.
	(pkgdata_MODULES): Added ext2.mod.
	(ext2_mod_SOURCES): New variable.
	(ext2_mod_CFLAGS): Likewise.
	* include/pupa/err.h (pupa_err_t): Added PUPA_ERR_SYMLINK_LOOP.
	* include/pupa/misc.h (pupa_strncpy): New prototype.
	(pupa_strcat): Likewise.
	(pupa_strncmp): Likewise.
	* kern/misc.c (pupa_strcat): Enable function.
	(pupa_strncpy): New function.
	(pupa_strncmp): Likewise.

	* kern/disk.c (pupa_disk_read): Set pupa_errno to PUPA_ERR_NONE
	when the read failed before retrying.
	* util/i386/pc/biosdisk.c (_LARGEFILE_SOURCE): Removed.
	(_FILE_OFFSET_BITS): Likewise.
	* configure.ac: Added AC_SYS_LARGEFILE.
2003-10-29 18:44:30 +00:00
okuji 18d9c7cd53 2003-09-25 Yoshinori K. Okuji <okuji@enbug.org>
I forgot to check in these changes for a long time. This adds
	incomplete support for VGA console, and this is still very
	buggy. Also, a lot of consideration is required for I18N,
	UNICODE, and VGA font issues. Therefore, assume that this is
	such that "better than nothing".

	* font/manager.c: New file.
	* include/pupa/font.h: Likewise.
	* include/pupa/i386/pc/vga.h: Likewise.
	* term/i386/pc/vga.c: Likewise.
	* util/unifont2pff.rb: Likewise.

	* conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vga.h.
	(pkgdata_MODULES): Added vga.mod and font.mod.
	(vga_mod_SOURCES): New variables.
	(vga_mod_CFLAGS): Likewise.
	(font_mod_SOURCES): Likewise.
	(font_mod_CFLAGS): Likewise.

	* include/pupa/err.h (PUPA_ERR_BAD_FONT): New constant.

	* include/pupa/term.h: Include pupa/err.h.
	(struct pupa_term): Added init and fini.
	Changed the argument of putchar to pupa_uint32_t.

	* include/pupa/i386/pc/console.h: Include pupa/symbol.h.
	(pupa_console_real_putchar): New prototype.
	(pupa_console_putchar): Removed.
	(pupa_console_checkkey): Exported.
	(pupa_console_getkey): Likewise.

	* kern/misc.c (pupa_vsprintf): Add support for UNICODE
	characters.

	* kern/term.c (pupa_term_set_current): Rewritten.
	(pupa_putchar): Likewise.
	(pupa_putcode): New function.

	* kern/i386/pc/startup.S (pupa_console_putchar): Renamed to ...
	(pupa_console_real_putchar): ... this.
	(pupa_vga_set_mode): New function.
	(pupa_vga_get_font): Likewise.

	* normal/command.c: Include pupa/term.h.
	(terminal_command): New function.
	(pupa_command_init): Register the command "terminal".

	* normal/menu.c (DISP_LEFT): Changed to a UNICODE value.
	(DISP_UP): Likewise.
	(DISP_RIGHT): Likewise.
	(DISP_DOWN): Likewise.
	(DISP_HLINE): Likewise.
	(DISP_VLINE): Likewise.
	(DISP_UL): Likewise.
	(DISP_UR): Likewise.
	(DISP_LL): Likewise.
	(DISP_LR): Likewise.

	* term/i386/pc/console.c (pupa_console_putchar): New function.
2003-09-25 20:15:53 +00:00
okuji a5ffe96617 2003-01-06 Yoshinori K. Okuji <okuji@enbug.org>
* util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h.
	(setup): Configure the installed partition information and the
	dl prefix.

	* loader/i386/pc/chainloader.c (my_mod): New variable.
	(pupa_chainloader_unload): New function.
	(pupa_rescue_cmd_chainloader): Refer itself.
	(PUPA_MOD_INIT): Save its own module in MY_MOD.

	* kern/i386/pc/startup.S (install_partition): Removed.
	(version_string): Likewise.
	(config_file): Likewise.
	(pupa_install_dos_part): New variable.
	(pupa_install_bsd_part): Likewise.
	(pupa_prefix): Likewise.
	(pupa_chainloader_real_boot): Call pupa_dl_unload_all.

	* kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h
	and pupa/misc.h.
	(make_install_device): New function.
	(pupa_machine_init): Set the dl prefix.

	* kern/rescue.c: Include pupa/rescue.h and pupa/dl.h.
	(buf): Renamed to ...
	(linebuf): ... this.
	(pupa_rescue_cmd_prefix): New function.
	(pupa_rescue_cmd_insmod): Likewise.
	(pupa_rescue_cmd_rmmod): Likewise.
	(pupa_rescue_cmd_lsmod): Likewise.
	(pupa_enter_rescue_mode): Register new commands: prefix, insmod,
	rmmod and lsmod.

	* kern/mm.c (pupa_memalign): If failed even after invalidating
	disk caches, unload unneeded modules and retry.

	* kern/misc.c (pupa_memmove): New function.
	(pupa_memcpy): Removed.
	(pupa_strcpy): New function.
	(pupa_itoa): Made static.

	* kern/dl.c (pupa_dl_iterate): New function.
	(pupa_dl_ref): Likewise.
	(pupa_dl_unref): Likewise.
	(pupa_dl_unload): Return if succeeded or not.
	(pupa_dl_unload_unneeded): New function.
	(pupa_dl_unload_all): Likewise.
	(pupa_dl_init): Renamed to ...
	(pupa_dl_set_prefix): ... this.
	(pupa_dl_get_prefix): New function.

	* include/pupa/i386/pc/kernel.h: Include pupa/types.h.
	(PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro.
	(PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise.
	(PUPA_KERNEL_MACHINE_PREFIX): Likewise.
	(pupa_install_dos_part): Declared.
	(pupa_install_bsd_part): Likewise.
	(pupa_prefix): Likewise.
	(pupa_boot_drive): Likewise.

	* include/pupa/types.h: Fix a typo.

	* include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to
	pupa_memmove.
	(pupa_memmove): Declared.
	(pupa_strcpy): Likewise.

	* include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now
	pupa_mod_init takes one argument, its own module.
	(pupa_dl_unload_unneeded): Declared.
	(pupa_dl_unload_all): Likewise.
	(pupa_dl_ref): Likewise.
	(pupa_dl_unref): Likewise.
	(pupa_dl_iterate): Likewise.
	(pupa_dl_init): Renamed to ...
	(pupa_dl_set_prefix): ... this.
	(pupa_dl_get_prefix): Declared.

	* fs/fat.c [!PUPA_UTIL] (my_mod): New variable.
	(pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being
	unloaded.
	(pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded.
	(pupa_fat_close) [!PUPA_UTIL]: Unrefer itself.

	* configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith,
	-Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
2003-01-06 00:01:35 +00:00
okuji 6a161fa938 Initial revision 2002-12-27 08:53:07 +00:00