From c913794f0cdf4baf33c195eb7700b7d75d24537f Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Sat, 26 Jul 2003 17:16:24 +0000 Subject: [w3m-dev 03945] Re: application/xhtml+xml support * Makefile.in (ETC_DIR): added (CONF_DIR): added (DEFS): add CONF_DIR (MAKE_ARGS): add CONF_DIR * config.h.in (SYS_MAILCAP): use CONF_DIR (SYS_URIMETHODMAP): use CONF_DIR * func.c (sys_current_keymap_file): added (interpret_keymap): added (initKeymap): use interpret_keymap (interpret_mouse_action): added (initMouseAction): use interpret_mouse_action * indep.c (w3m_conf_dir): added * indep.h (w3m_conf_dir): added * menu.c (interpret_menu): added (initMenu): use interpret_menu * proto.h (confFile): added * rc.c (init_rc): read config file by interpret_rc (confFile): added From: Hironori SAKAMOTO --- menu.c | 56 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index a2f0759..7c3e15a 100644 --- a/menu.c +++ b/menu.c @@ -1,4 +1,4 @@ -/* $Id: menu.c,v 1.31 2003/02/05 16:44:00 ukai Exp $ */ +/* $Id: menu.c,v 1.32 2003/07/26 17:16:24 ukai Exp $ */ /* * w3m menu.c */ @@ -1669,32 +1669,14 @@ optionMenu(int x, int y, char **label, int *variable, int initial, /* --- InitMenu --- */ -void -initMenu(void) +static void +interpret_menu(FILE *mf) { - FILE *mf; Str line; char *p, *s; - int in_menu, nmenu = 0, nitem = 0, type; + int in_menu = 0, nmenu = 0, nitem = 0, type; MenuItem *item = NULL; - MenuList *list; - - w3mMenuList = New_N(MenuList, 3); - w3mMenuList[0].id = "Main"; - w3mMenuList[0].menu = &MainMenu; - w3mMenuList[0].item = MainMenuItem; - w3mMenuList[1].id = "Select"; - w3mMenuList[1].menu = &SelectMenu; - w3mMenuList[1].item = NULL; - w3mMenuList[2].id = "SelectTab"; - w3mMenuList[2].menu = &SelTabMenu; - w3mMenuList[2].item = NULL; - w3mMenuList[3].id = NULL; - - if ((mf = fopen(rcFile(MENU_FILE), "rt")) == NULL) - goto create_menu; - in_menu = 0; while (!feof(mf)) { line = Strfgets(mf); Strchop(line); @@ -1734,9 +1716,35 @@ initMenu(void) item[nitem].type = MENU_END; } } - fclose(mf); +} + +void +initMenu(void) +{ + FILE *mf; + MenuList *list; + + w3mMenuList = New_N(MenuList, 3); + w3mMenuList[0].id = "Main"; + w3mMenuList[0].menu = &MainMenu; + w3mMenuList[0].item = MainMenuItem; + w3mMenuList[1].id = "Select"; + w3mMenuList[1].menu = &SelectMenu; + w3mMenuList[1].item = NULL; + w3mMenuList[2].id = "SelectTab"; + w3mMenuList[2].menu = &SelTabMenu; + w3mMenuList[2].item = NULL; + w3mMenuList[3].id = NULL; + + if ((mf = fopen(confFile(MENU_FILE), "rt")) != NULL) { + interpret_menu(mf); + fclose(mf); + } + if ((mf = fopen(rcFile(MENU_FILE), "rt")) != NULL) { + interpret_menu(mf); + fclose(mf); + } - create_menu: for (list = w3mMenuList; list->id != NULL; list++) { if (list->item == NULL) continue; -- cgit v1.2.3