Skip to main content
Sign in
Snippets Groups Projects
Select Git revision
12 results Searching

menu.c

Blame
  • user avatar
    EGRY Gabor authored and Sam Ravnborg committed
    This patch removes the indirect I18N support for config file.
    
    Signed-off-by: default avatarEgry Gabor <gaboregry1@t-online.hu>
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Cc: Roman Zippel <zippel@linux-m68k.org>
    01771b0f
    History
    menu.c 10.55 KiB
    /*
     * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
     * Released under the terms of the GNU GPL v2.0.
     */
    
    #include <stdlib.h>
    #include <string.h>
    
    #define LKC_DIRECT_LINK
    #include "lkc.h"
    
    struct menu rootmenu;
    static struct menu **last_entry_ptr;
    
    struct file *file_list;
    struct file *current_file;
    
    static void menu_warn(struct menu *menu, const char *fmt, ...)
    {
    	va_list ap;
    	va_start(ap, fmt);
    	fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
    	vfprintf(stderr, fmt, ap);
    	fprintf(stderr, "\n");
    	va_end(ap);
    }
    
    static void prop_warn(struct property *prop, const char *fmt, ...)
    {
    	va_list ap;
    	va_start(ap, fmt);
    	fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno);
    	vfprintf(stderr, fmt, ap);
    	fprintf(stderr, "\n");
    	va_end(ap);
    }
    
    void menu_init(void)
    {
    	current_entry = current_menu = &rootmenu;
    	last_entry_ptr = &rootmenu.list;
    }
    
    void menu_add_entry(struct symbol *sym)
    {
    	struct menu *menu;
    
    	menu = malloc(sizeof(*menu));
    	memset(menu, 0, sizeof(*menu));
    	menu->sym = sym;
    	menu->parent = current_menu;
    	menu->file = current_file;
    	menu->lineno = zconf_lineno();
    
    	*last_entry_ptr = menu;
    	last_entry_ptr = &menu->next;
    	current_entry = menu;
    }
    
    void menu_end_entry(void)
    {
    }
    
    struct menu *menu_add_menu(void)
    {
    	menu_end_entry();
    	last_entry_ptr = &current_entry->list;
    	return current_menu = current_entry;
    }