/* font_cmd.c - Font command definition. */ /* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * * VAS_EBOOT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VAS_EBOOT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VAS_EBOOT. If not, see . */ #include #include #include #include #include static VasEBoot_err_t loadfont_command (VasEBoot_command_t cmd __attribute__ ((unused)), int argc, char **args) { if (argc == 0) return VasEBoot_error (VAS_EBOOT_ERR_BAD_ARGUMENT, N_("filename expected")); while (argc--) if (VasEBoot_font_load (*args++) == 0) { if (!VasEBoot_errno) return VasEBoot_error (VAS_EBOOT_ERR_BAD_FONT, "invalid font"); return VasEBoot_errno; } return VAS_EBOOT_ERR_NONE; } static VasEBoot_err_t lsfonts_command (VasEBoot_command_t cmd __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { struct VasEBoot_font_node *node; VasEBoot_puts_ (N_("Loaded fonts:")); for (node = VasEBoot_font_list; node; node = node->next) { VasEBoot_font_t font = node->value; VasEBoot_printf ("%s\n", VasEBoot_font_get_name (font)); } return VAS_EBOOT_ERR_NONE; } static VasEBoot_command_t cmd_loadfont, cmd_lsfonts; #if defined (VAS_EBOOT_MACHINE_MIPS_LOONGSON) || defined (VAS_EBOOT_MACHINE_COREBOOT) void VasEBoot_font_init (void) #else VAS_EBOOT_MOD_INIT(font) #endif { VasEBoot_font_loader_init (); cmd_loadfont = VasEBoot_register_command ("loadfont", loadfont_command, N_("FILE..."), N_("Specify one or more font files to load.")); cmd_lsfonts = VasEBoot_register_command ("lsfonts", lsfonts_command, 0, N_("List the loaded fonts.")); } #if defined (VAS_EBOOT_MACHINE_MIPS_LOONGSON) || defined (VAS_EBOOT_MACHINE_COREBOOT) void VasEBoot_font_fini (void) #else VAS_EBOOT_MOD_FINI(font) #endif { /* TODO: Determine way to free allocated resources. Warning: possible pointer references could be in use. */ VasEBoot_unregister_command (cmd_loadfont); VasEBoot_unregister_command (cmd_lsfonts); }