Commit 51399a39 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6

* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: (38 commits)
  kbuild: convert `arch/tile' to the kconfig mainmenu upgrade
  README: cite nconfig
  Revert "kconfig: Temporarily disable dependency warnings"
  kconfig: Use PATH_MAX instead of 128 for path buffer sizes.
  kconfig: Fix realloc usage()
  kconfig: Propagate const
  kconfig: Don't go out from read config loop when you read new symbol
  kconfig: fix menuconfig on debian lenny
  kbuild: migrate all arch to the kconfig mainmenu upgrade
  kconfig: expand file names
  kconfig: use the file's name of sourced file
  kconfig: constify file name
  kconfig: don't emit warning upon rootmenu's prompt redefinition
  kconfig: replace KERNELVERSION usage by the mainmenu's prompt
  kconfig: delay gconf window initialization
  kconfig: expand by default the rootmenu's prompt
  kconfig: add a symbol string expansion helper
  kconfig: regen parser
  kconfig: implement the `mainmenu' directive
  kconfig: allow PACKAGE to be defined on the compiler's command-line
  ...

Fix up trivial conflict in arch/mn10300/Kconfig
parents b779b332 df4d3036
......@@ -322,7 +322,8 @@ mainmenu:
"mainmenu" <prompt>
This sets the config program's title bar if the config program chooses
to use it.
to use it. It should be placed at the top of the configuration, before any
other statement.
Kconfig hints
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/$ARCH $KERNELVERSION Kernel Configuration"
config SRCARCH
string
option env="SRCARCH"
source "arch/$SRCARCH/Kconfig"
......@@ -166,6 +166,7 @@ CONFIGURING the kernel:
- Alternate configuration commands are:
"make config" Plain text interface.
"make menuconfig" Text based color menus, radiolists & dialogs.
"make nconfig" Enhanced text based color menus.
"make xconfig" X windows (Qt) based configuration tool.
"make gconfig" X windows (Gtk) based configuration tool.
"make oldconfig" Default all questions based on the contents of
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
config ALPHA
bool
default y
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux Kernel Configuration"
config ARM
bool
default y
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux Kernel Configuration"
config AVR32
def_bool y
# With EMBEDDED=n, we get lots of stuff automatically selected
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Blackfin Kernel Configuration"
config SYMBOL_PREFIX
string
default "_"
......
#
# For a description of the syntax of this configuration file,
# see the Configure script.
#
mainmenu "Linux/CRIS Kernel Configuration"
config MMU
bool
default y
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
config FRV
bool
default y
......@@ -61,8 +57,6 @@ config HZ
int
default 1000
mainmenu "Fujitsu FR-V Kernel Configuration"
source "init/Kconfig"
source "kernel/Kconfig.freezer"
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration"
config H8300
bool
default y
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "IA-64 Linux Kernel Configuration"
source "init/Kconfig"
source "kernel/Kconfig.freezer"
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/M32R Kernel Configuration"
config M32R
bool
default y
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
config M68K
bool
default y
......@@ -62,8 +58,6 @@ config HZ
config ARCH_USES_GETTIMEOFFSET
def_bool y
mainmenu "Linux/68k Kernel Configuration"
source "init/Kconfig"
source "kernel/Kconfig.freezer"
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "uClinux/68k (w/o MMU) Kernel Configuration"
config M68K
bool
default y
......
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
mainmenu "Linux/Microblaze Kernel Configuration"
config MICROBLAZE
def_bool y
select HAVE_MEMBLOCK
......
......@@ -15,8 +15,6 @@ config MIPS
select RTC_LIB if !MACH_LOONGSON
select GENERIC_ATOMIC64 if !64BIT
mainmenu "Linux/MIPS Kernel Configuration"
menu "Machine selection"
config ZONE_DMA
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux Kernel Configuration"
config MN10300
def_bool y
select HAVE_OPROFILE
......@@ -93,8 +86,6 @@ config GENERIC_HARDIRQS
config HOTPLUG_CPU
def_bool n
mainmenu "Panasonic MN10300/AM33 Kernel Configuration"
source "init/Kconfig"
source "kernel/Kconfig.freezer"
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/PA-RISC Kernel Configuration"
config PARISC
def_bool y
select HAVE_IDE
......
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/PowerPC Kernel Configuration"
source "arch/powerpc/platforms/Kconfig.cputype"
config PPC32
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
config SCHED_MC
def_bool y
depends on SMP
......@@ -78,8 +73,6 @@ config VIRT_CPU_ACCOUNTING
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y
mainmenu "Linux Kernel Configuration"
config S390
def_bool y
select USE_GENERIC_SMP_HELPERS if SMP
......
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
mainmenu "Linux/SCORE Kernel Configuration"
menu "Machine selection"
choice
......
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/SuperH Kernel Configuration"
config SUPERH
def_bool y
select EMBEDDED
......
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/SPARC Kernel Configuration"
config 64BIT
bool "64-bit kernel" if ARCH = "sparc"
default ARCH = "sparc64"
......
......@@ -117,8 +117,6 @@ config TILE
# config HUGETLB_PAGE_SIZE_VARIABLE
mainmenu "Linux/TILE Kernel Configuration"
# Please note: TILE-Gx support is not yet finalized; this is
# the preliminary support. TILE-Gx drivers are only provided
# with the alpha or beta test versions for Tilera customers.
......
......@@ -19,8 +19,6 @@ config MMU
config NO_IOMEM
def_bool y
mainmenu "Linux/Usermode Kernel Configuration"
config ISA
bool
......
# x86 configuration
mainmenu "Linux Kernel Configuration for x86"
# Select 32 or 64 bit
config 64BIT
bool "64-bit kernel" if ARCH = "x86"
......
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
mainmenu "Linux/Xtensa Kernel Configuration"
config FRAME_POINTER
def_bool n
......
......@@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c
ifdef KBUILD_KCONFIG
Kconfig := $(KBUILD_KCONFIG)
else
Kconfig := arch/$(SRCARCH)/Kconfig
Kconfig := Kconfig
endif
xconfig: $(obj)/qconf
......@@ -145,11 +145,8 @@ check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
# Use recursively expanded variables so we do not call gcc unless
# we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
-DLOCALE
# ===========================================================================
# Shared Makefile for the various kconfig executables:
......@@ -208,7 +205,7 @@ clean-files += config.pot linux.pot
PHONY += $(obj)/dochecklxdialog
$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES)
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
always := dochecklxdialog
......@@ -226,6 +223,8 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
-D LKC_DIRECT_LINK
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
......@@ -236,6 +235,8 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort...
$(obj)/.tmp_qtcheck:
@set -e; echo " CHECK qt"; dir=""; pkg=""; \
if ! pkg-config --exists QtCore 2> /dev/null; then \
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
if [ -n "$$pkg" ]; then \
......@@ -249,10 +250,10 @@ $(obj)/.tmp_qtcheck:
done; \
if [ -z "$$dir" ]; then \
echo "*"; \
echo "* Unable to find the QT3 installation. Please make sure that"; \
echo "* the QT3 development package is correctly installed and"; \
echo "* either install pkg-config or set the QTDIR environment"; \
echo "* variable to the correct location."; \
echo "* Unable to find any QT installation. Please make sure that"; \
echo "* the QT4 or QT3 development package is correctly installed and"; \
echo "* either qmake can be found or install pkg-config or set"; \
echo "* the QTDIR environment variable to the correct location."; \
echo "*"; \
false; \
fi; \
......@@ -271,6 +272,12 @@ $(obj)/.tmp_qtcheck:
echo "*"; \
moc="/usr/bin/moc"; \
fi; \
else \
cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
moc="$$binpath/bin/moc"; \
fi; \
echo "KC_QT_CFLAGS=$$cflags" > $@; \
echo "KC_QT_LIBS=$$libs" >> $@; \
echo "KC_QT_MOC=$$moc" >> $@
......
......@@ -425,7 +425,7 @@ static void check_conf(struct menu *menu)
(sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
if (input_mode == listnewconfig) {
if (sym->name && !sym_is_choice_value(sym)) {
printf("CONFIG_%s\n", sym->name);
printf("%s%s\n", CONFIG_, sym->name);
}
} else if (input_mode != oldnoconfig) {
if (!conf_cnt++)
......@@ -466,7 +466,7 @@ int main(int ac, char **av)
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) {
while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
input_mode = (enum input_mode)opt;
switch (opt) {
case silentoldconfig:
......@@ -508,8 +508,7 @@ int main(int ac, char **av)
name = conf_get_configname();
if (stat(name, &tmpstat)) {
fprintf(stderr, _("***\n"
"*** You have not yet configured your kernel!\n"
"*** (missing kernel config file \"%s\")\n"
"*** Configuration file \"%s\" not found!\n"
"***\n"
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
"*** \"make menuconfig\" or \"make xconfig\").\n"
......@@ -571,7 +570,7 @@ int main(int ac, char **av)
name = getenv("KCONFIG_NOSILENTUPDATE");
if (name && *name) {
fprintf(stderr,
_("\n*** Kernel configuration requires explicit update.\n\n"));
_("\n*** The configuration requires explicit update.\n\n"));
return 1;
}
}
......@@ -623,11 +622,11 @@ int main(int ac, char **av)
* All other commands are only used to generate a config.
*/
if (conf_get_changed() && conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
exit(1);
}
if (conf_write_autoconf()) {
fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
return 1;
}
} else if (input_mode == savedefconfig) {
......@@ -638,7 +637,7 @@ int main(int ac, char **av)
}
} else if (input_mode != listnewconfig) {
if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
exit(1);
}
}
......
......@@ -5,6 +5,7 @@
#include <sys/stat.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -18,6 +19,9 @@
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static void conf_message(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
static const char *conf_filename;
static int conf_lineno, conf_warnings, conf_unsaved;
......@@ -34,6 +38,29 @@ static void conf_warning(const char *fmt, ...)
conf_warnings++;
}
static void conf_default_message_callback(const char *fmt, va_list ap)
{
printf("#\n# ");
vprintf(fmt, ap);
printf("\n#\n");
}
static void (*conf_message_callback) (const char *fmt, va_list ap) =
conf_default_message_callback;
void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
{
conf_message_callback = fn;
}
static void conf_message(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (conf_message_callback)
conf_message_callback(fmt, ap);
}
const char *conf_get_configname(void)
{
char *name = getenv("KCONFIG_CONFIG");
......@@ -183,9 +210,8 @@ int conf_read_simple(const char *name, int def)
name = conf_expand_value(prop->expr->left.sym->name);
in = zconf_fopen(name);
if (in) {
printf(_("#\n"
"# using defaults found in %s\n"
"#\n"), name);
conf_message(_("using defaults found in %s"),
name);
goto load;
}
}
......@@ -220,24 +246,23 @@ int conf_read_simple(const char *name, int def)
while (fgets(line, sizeof(line), in)) {
conf_lineno++;
sym = NULL;
switch (line[0]) {
case '#':
if (memcmp(line + 2, "CONFIG_", 7))
if (line[0] == '#') {
if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
continue;
p = strchr(line + 9, ' ');
p = strchr(line + 2 + strlen(CONFIG_), ' ');
if (!p)
continue;
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
if (def == S_DEF_USER) {
sym = sym_find(line + 9);
sym = sym_find(line + 2 + strlen(CONFIG_));
if (!sym) {
sym_add_change_count(1);
break;
goto setsym;
}
} else {
sym = sym_lookup(line + 9, 0);
sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_BOOLEAN;
}
......@@ -253,13 +278,8 @@ int conf_read_simple(const char *name, int def)
default:
;
}
break;
case 'C':
if (memcmp(line, "CONFIG_", 7)) {
conf_warning("unexpected data");
continue;
}
p = strchr(line + 7, '=');
} else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
p = strchr(line + strlen(CONFIG_), '=');
if (!p)
continue;
*p++ = 0;
......@@ -270,13 +290,13 @@ int conf_read_simple(const char *name, int def)
*p2 = 0;
}
if (def == S_DEF_USER) {
sym = sym_find(line + 7);
sym = sym_find(line + strlen(CONFIG_));
if (!sym) {
sym_add_change_count(1);
break;
goto setsym;
}
} else {
sym = sym_lookup(line + 7, 0);
sym = sym_lookup(line + strlen(CONFIG_), 0);
if (sym->type == S_UNKNOWN)
sym->type = S_OTHER;
}
......@@ -285,14 +305,12 @@ int conf_read_simple(const char *name, int def)
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
break;
case '\r':
case '\n':
break;
default:
} else {
if (line[0] != '\r' && line[0] != '\n')
conf_warning("unexpected data");
continue;
}
setsym:
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->def[def].tri) {
......@@ -405,9 +423,9 @@ static void conf_write_string(bool headerfile, const char *name,
{
int l;
if (headerfile)
fprintf(out, "#define CONFIG_%s \"", name);
fprintf(out, "#define %s%s \"", CONFIG_, name);
else
fprintf(out, "CONFIG_%s=\"", name);
fprintf(out, "%s%s=\"", CONFIG_, name);
while (1) {
l = strcspn(str, "\"\\");
......@@ -433,13 +451,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
switch (sym_get_tristate_value(sym)) {
case no:
if (write_no)
fprintf(out, "# CONFIG_%s is not set\n", sym->name);
fprintf(out, "# %s%s is not set\n",
CONFIG_, sym->name);
break;
case mod:
fprintf(out, "CONFIG_%s=m\n", sym->name);
fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
break;
case yes:
fprintf(out, "CONFIG_%s=y\n", sym->name);
fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
break;
}
break;
......@@ -449,7 +468,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
case S_HEX:
case S_INT:
str = sym_get_string_value(sym);
fprintf(out, "CONFIG_%s=%s\n", sym->name, str);
fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
break;
case S_OTHER:
case S_UNKNOWN:
......@@ -541,7 +560,7 @@ int conf_write(const char *name)
struct menu *menu;
const char *basename;
const char *str;
char dirname[128], tmpname[128], newname[128];
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
enum symbol_type type;
time_t now;
int use_timestamp = 1;
......@@ -581,8 +600,6 @@ int conf_write(const char *name)
if (!out)
return 1;
sym = sym_lookup("KERNELVERSION", 0);
sym_calc_value(sym);
time(&now);
env = getenv("KCONFIG_NOTIMESTAMP");
if (env && *env)
......@@ -590,10 +607,10 @@ int conf_write(const char *name)
fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n"
"# Linux kernel version: %s\n"
"# %s\n"
"%s%s"
"#\n"),
sym_get_string_value(sym),
rootmenu.prompt->text,
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
......@@ -650,9 +667,7 @@ int conf_write(const char *name)
return 1;
}
printf(_("#\n"
"# configuration written to %s\n"
"#\n"), newname);
conf_message(_("configuration written to %s"), newname);
sym_set_change_count(0);
......@@ -662,7 +677,7 @@ int conf_write(const char *name)
static int conf_split_config(void)
{
const char *name;
char path[128];
char path[PATH_MAX+1];
char *s, *d, c;
struct symbol *sym;
struct stat sb;
......@@ -804,25 +819,23 @@ int conf_write_autoconf(void)
return 1;
}
sym = sym_lookup("KERNELVERSION", 0);
sym_calc_value(sym);
time(&now);
fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n"
"# Linux kernel version: %s\n"
"# %s\n"
"# %s"
"#\n",
sym_get_string_value(sym), ctime(&now));
rootmenu.prompt->text, ctime(&now));
fprintf(tristate, "#\n"
"# Automatically generated - do not edit\n"
"\n");
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
" * Linux kernel version: %s\n"
" * %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n",
sym_get_string_value(sym), ctime(&now));
rootmenu.prompt->text, ctime(&now));
for_all_symbols(i, sym) {
sym_calc_value(sym);
......@@ -840,14 +853,17 @@ int conf_write_autoconf(void)
case no:
break;
case mod:
fprintf(tristate, "CONFIG_%s=M\n", sym->name);
fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
fprintf(tristate, "%s%s=M\n",
CONFIG_, sym->name);
fprintf(out_h, "#define %s%s_MODULE 1\n",
CONFIG_, sym->name);
break;
case yes:
if (sym->type == S_TRISTATE)
fprintf(tristate, "CONFIG_%s=Y\n",
sym->name);
fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);
fprintf(tristate,"%s%s=Y\n",
CONFIG_, sym->name);
fprintf(out_h, "#define %s%s 1\n",
CONFIG_, sym->name);
break;
}
break;
......@@ -857,12 +873,14 @@ int conf_write_autoconf(void)
case S_HEX:
str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);
fprintf(out_h, "#define %s%s 0x%s\n",
CONFIG_, sym->name, str);
break;
}
case S_INT:
str = sym_get_string_value(sym);
fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);
fprintf(out_h, "#define %s%s %s\n",
CONFIG_, sym->name, str);
break;
default:
break;
......
......@@ -18,7 +18,7 @@ extern "C" {
struct file {
struct file *next;
struct file *parent;
char *name;
const char *name;
int lineno;
int flags;
};
......
......@@ -133,7 +133,6 @@ void init_main_window(const gchar * glade_file)
GladeXML *xml;
GtkWidget *widget;
GtkTextBuffer *txtbuf;
char title[256];
GtkStyle *style;
xml = glade_xml_new(glade_file, "window1", NULL);
......@@ -210,9 +209,7 @@ void init_main_window(const gchar * glade_file)
/*"style", PANGO_STYLE_OBLIQUE, */
NULL);
sprintf(title, _("Linux Kernel v%s Configuration"),
getenv("KERNELVERSION"));
gtk_window_set_title(GTK_WINDOW(main_wnd), title);
gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
gtk_widget_show(main_wnd);
}
......@@ -671,8 +668,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *intro_text = _(
"Welcome to gkc, the GTK+ graphical kernel configuration tool\n"
"for Linux.\n"
"Welcome to gkc, the GTK+ graphical configuration tool\n"
"For each option, a blank box indicates the feature is disabled, a\n"
"check indicates it is enabled, and a dot indicates that it is to\n"
"be compiled as a module. Clicking on the box will cycle through the three states.\n"
......@@ -1531,12 +1527,6 @@ int main(int ac, char *av[])
else
glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL);
/* Load the interface and connect signals */
init_main_window(glade_file);
init_tree_model();
init_left_tree();
init_right_tree();
/* Conf stuffs */
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
......@@ -1556,6 +1546,12 @@ int main(int ac, char *av[])
fixup_rootmenu(&rootmenu);
conf_read(NULL);
/* Load the interface and connect signals */
init_main_window(glade_file);
init_tree_model();
init_left_tree();
init_right_tree();
switch (view_mode) {
case SINGLE_VIEW:
display_tree_part();
......
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
......
......@@ -63,11 +63,11 @@ static char *escape(const char* text, char *bf, int len)
struct file_line {
struct file_line *next;
char* file;
const char *file;
int lineno;
};
static struct file_line *file_line__new(char *file, int lineno)
static struct file_line *file_line__new(const char *file, int lineno)
{
struct file_line *self = malloc(sizeof(*self));
......@@ -90,7 +90,8 @@ struct message {
static struct message *message__list;
static struct message *message__new(const char *msg, char *option, char *file, int lineno)
static struct message *message__new(const char *msg, char *option,
const char *file, int lineno)
{
struct message *self = malloc(sizeof(*self));
......@@ -130,7 +131,8 @@ static struct message *mesage__find(const char *msg)
return m;
}
static int message__add_file_line(struct message *self, char *file, int lineno)
static int message__add_file_line(struct message *self, const char *file,
int lineno)
{
int rc = -1;
struct file_line *fl = file_line__new(file, lineno);
......@@ -145,7 +147,8 @@ static int message__add_file_line(struct message *self, char *file, int lineno)
return rc;
}
static int message__add(const char *msg, char *option, char *file, int lineno)
static int message__add(const char *msg, char *option, const char *file,
int lineno)
{
int rc = 0;
char bf[16384];
......
......@@ -2373,9 +2373,10 @@ void zconf_nextfile(const char *name)
memset(buf, 0, sizeof(*buf));
current_buf->state = YY_CURRENT_BUFFER;
zconfin = zconf_fopen(name);
zconfin = zconf_fopen(file->name);
if (!zconfin) {
printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
printf("%s:%d: can't open file \"%s\"\n",
zconf_curname(), zconf_lineno(), file->name);
exit(1);
}
zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
......@@ -2422,7 +2423,7 @@ int zconf_lineno(void)
return current_pos.lineno;
}
char *zconf_curname(void)
const char *zconf_curname(void)
{
return current_pos.file ? current_pos.file->name : "<none>";
}
......
......@@ -31,12 +31,18 @@ extern "C" {
#define SRCTREE "srctree"
#ifndef PACKAGE
#define PACKAGE "linux"
#endif
#define LOCALEDIR "/usr/share/locale"
#define _(text) gettext(text)
#define N_(text) (text)
#ifndef CONFIG_
#define CONFIG_ "CONFIG_"
#endif
#define TF_COMMAND 0x0001
#define TF_PARAM 0x0002
......@@ -70,7 +76,7 @@ FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
void zconf_nextfile(const char *name);
int zconf_lineno(void);
char *zconf_curname(void);
const char *zconf_curname(void);
/* conf.c */
void xfgets(char *str, int size, FILE *in);
......
#include <stdarg.h>
/* confdata.c */
P(conf_parse,void,(const char *name));
......@@ -8,6 +9,7 @@ P(conf_write,int,(const char *name));
P(conf_write_autoconf,int,(void));
P(conf_get_changed,bool,(void));
P(conf_set_changed_callback, void,(void (*fn)(void)));
P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
/* menu.c */
P(rootmenu,struct menu,);
......@@ -28,6 +30,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
P(sym_lookup,struct symbol *,(const char *name, int flags));
P(sym_find,struct symbol *,(const char *name));
P(sym_expand_string_value,const char *,(const char *in));
P(sym_re_search,struct symbol **,(const char *pattern));
P(sym_type_name,const char *,(enum symbol_type type));
P(sym_calc_value,void,(struct symbol *sym));
......
......@@ -23,6 +23,8 @@ ccflags()
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncurses/curses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
elif [ -f /usr/include/ncursesw/curses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
elif [ -f /usr/include/ncurses.h ]; then
echo '-DCURSES_LOC="<ncurses.h>"'
else
......
......@@ -25,11 +25,9 @@
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
"Some kernel features may be built directly into the kernel.\n"
"Some may be made into loadable runtime modules. Some features\n"
"may be completely removed altogether. There are also certain\n"
"kernel parameters which are not really features, but must be\n"
"entered in as decimal or hexadecimal numbers or possibly text.\n"
"This interface let you select features and parameters for the build.\n"
"Features can either be built-in, modularized, or ignored. Parameters\n"
"must be entered in as decimal or hexadecimal numbers or text.\n"
"\n"
"Menu items beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"
......@@ -117,7 +115,7 @@ static const char mconf_readme[] = N_(
"-----------------------------\n"
"Menuconfig supports the use of alternate configuration files for\n"
"those who, for various reasons, find it necessary to switch\n"
"between different kernel configurations.\n"
"between different configurations.\n"
"\n"
"At the end of the main menu you will find two options. One is\n"
"for saving the current configuration to a file of your choosing.\n"
......@@ -150,9 +148,9 @@ static const char mconf_readme[] = N_(
"\n"
"Optional personality available\n"
"------------------------------\n"
"If you prefer to have all of the kernel options listed in a single\n"
"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"If you prefer to have all of the options listed in a single menu, rather\n"
"than the default multimenu hierarchy, run the menuconfig with\n"
"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make MENUCONFIG_MODE=single_menu menuconfig\n"
"\n"
......@@ -207,12 +205,12 @@ load_config_text[] = N_(
"last retrieved. Leave blank to abort."),
load_config_help[] = N_(
"\n"
"For various reasons, one may wish to keep several different kernel\n"
"For various reasons, one may wish to keep several different\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
"kernel's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
"default one, entering its name here will allow you to modify that\n"
"configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
"configuration files. You should therefore leave this blank to abort.\n"),
......@@ -221,8 +219,8 @@ save_config_text[] = N_(
"as an alternate. Leave blank to abort."),
save_config_help[] = N_(
"\n"
"For various reasons, one may wish to keep different kernel\n"
"configurations available on a single machine.\n"
"For various reasons, one may wish to keep different configurations\n"
"available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
......@@ -232,7 +230,7 @@ save_config_help[] = N_(
"leave this blank.\n"),
search_help[] = N_(
"\n"
"Search for CONFIG_ symbols and display their relations.\n"
"Search for symbols and display their relations.\n"
"Regular expressions are allowed.\n"
"Example: search for \"^FOO\"\n"
"Result:\n"
......@@ -249,7 +247,7 @@ search_help[] = N_(
"Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Prompt:' shows the text used in the menu structure for\n"
" this CONFIG_ symbol\n"
" this symbol\n"
"o The 'Defined at' line tell at what file / line number the symbol\n"
" is defined\n"
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
......@@ -265,9 +263,9 @@ search_help[] = N_(
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
"Examples: USB => find all CONFIG_ symbols containing USB\n"
" ^USB => find all CONFIG_ symbols starting with USB\n"
" USB$ => find all CONFIG_ symbols ending with USB\n"
"Examples: USB => find all symbols containing USB\n"
" ^USB => find all symbols starting with USB\n"
" USB$ => find all symbols ending with USB\n"
"\n");
static int indent;
......@@ -290,13 +288,9 @@ static void set_config_filename(const char *config_filename)
{
static char menu_backtitle[PATH_MAX+128];
int size;
struct symbol *sym;
sym = sym_lookup("KERNELVERSION", 0);
sym_calc_value(sym);
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
_("%s - Linux Kernel v%s Configuration"),
config_filename, sym_get_string_value(sym));
"%s - %s", config_filename, rootmenu.prompt->text);
if (size >= sizeof(menu_backtitle))
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
set_dialog_backtitle(menu_backtitle);
......@@ -316,8 +310,8 @@ static void search_conf(void)
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
_("Enter CONFIG_ (sub)string to search for "
"(with or without \"CONFIG\")"),
_("Enter " CONFIG_ " (sub)string to search for "
"(with or without \"" CONFIG_ "\")"),
10, 75, "");
switch (dres) {
case 0:
......@@ -329,10 +323,10 @@ static void search_conf(void)
return;
}
/* strip CONFIG_ if necessary */
/* strip the prefix if necessary */
dialog_input = dialog_input_result;
if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
dialog_input += 7;
if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
dialog_input += strlen(CONFIG_);
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr);
......@@ -834,7 +828,7 @@ int main(int ac, char **av)
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your "
"new kernel configuration?\n"
"new configuration?\n"
"<ESC><ESC> to continue."),
6, 60);
else
......@@ -846,20 +840,20 @@ int main(int ac, char **av)
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error during writing of the kernel configuration.\n"
"Your kernel configuration changes were NOT saved."
"Error while writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
case -1:
printf(_("\n\n"
"*** End of Linux kernel configuration.\n"
"*** Execute 'make' to build the kernel or try 'make help'."
"*** End of the configuration.\n"
"*** Execute 'make' to start the build or try 'make help'."
"\n\n"));
break;
default:
fprintf(stderr, _("\n\n"
"Your kernel configuration changes were NOT saved."
"Your configuration changes were NOT saved."
"\n\n"));
}
......
......@@ -10,7 +10,7 @@
#include "lkc.h"
static const char nohelp_text[] = N_(
"There is no help available for this kernel option.\n");
"There is no help available for this option.\n");
struct menu rootmenu;
static struct menu **last_entry_ptr;
......@@ -138,7 +138,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
while (isspace(*prompt))
prompt++;
}
if (current_entry->prompt)
if (current_entry->prompt && current_entry != &rootmenu)
prop_warn(prop, "prompt redefined");
current_entry->prompt = prop;
}
......@@ -563,7 +563,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
if (menu_has_help(menu)) {
if (sym->name) {
str_printf(help, "CONFIG_%s:\n\n", sym->name);
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
str_append(help, _(menu_get_help(menu)));
str_append(help, "\n");
}
......
This diff is collapsed.
......@@ -137,7 +137,7 @@ void set_colors()
if (has_colors()) {
normal_color_theme();
} else {
/* give deafults */
/* give defaults */
no_colors_theme();
}
}
......@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win,
length = strlen(string);
temp = (width - length) / 2;
x = startx + (int)temp;
wattrset(win, color);
(void) wattrset(win, color);
mvwprintw(win, y, x, "%s", string);
refresh();
}
......@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
wattrset(win, attributes[DIALOG_BOX]);
(void) wattrset(win, attributes[DIALOG_BOX]);
box(win, 0, 0);
/* print message */
wattrset(msg_win, attributes[DIALOG_TEXT]);
(void) wattrset(msg_win, attributes[DIALOG_TEXT]);
fill_window(msg_win, msg);
set_menu_win(menu, win);
......@@ -392,16 +392,16 @@ int dialog_inputbox(WINDOW *main_window,
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
keypad(form_win, TRUE);
wattrset(form_win, attributes[INPUT_FIELD]);
(void) wattrset(form_win, attributes[INPUT_FIELD]);
wattrset(win, attributes[INPUT_BOX]);
(void) wattrset(win, attributes[INPUT_BOX]);
box(win, 0, 0);
wattrset(win, attributes[INPUT_HEADING]);
(void) wattrset(win, attributes[INPUT_HEADING]);
if (title)
mvwprintw(win, 0, 3, "%s", title);
/* print message */
wattrset(prompt_win, attributes[INPUT_TEXT]);
(void) wattrset(prompt_win, attributes[INPUT_TEXT]);
fill_window(prompt_win, prompt);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
......@@ -531,7 +531,7 @@ void show_scroll_win(WINDOW *main_window,
/* create the pad */
pad = newpad(total_lines+10, total_cols+10);
wattrset(pad, attributes[SCROLLWIN_TEXT]);
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
fill_window(pad, text);
win_lines = min(total_lines+4, LINES-2);
......@@ -546,9 +546,9 @@ void show_scroll_win(WINDOW *main_window,
win = newwin(win_lines, win_cols, y, x);
keypad(win, TRUE);
/* show the help in the help window, and show the help panel */
wattrset(win, attributes[SCROLLWIN_BOX]);
(void) wattrset(win, attributes[SCROLLWIN_BOX]);
box(win, 0, 0);
wattrset(win, attributes[SCROLLWIN_HEADING]);
(void) wattrset(win, attributes[SCROLLWIN_HEADING]);
mvwprintw(win, 0, 3, " %s ", title);
panel = new_panel(win);
......
......@@ -69,7 +69,8 @@ typedef enum {
F_BACK = 5,
F_SAVE = 6,
F_LOAD = 7,
F_EXIT = 8
F_SEARCH = 8,
F_EXIT = 9,
} function_key;
void set_colors(void);
......
This diff is collapsed.
......@@ -3,26 +3,25 @@
* Released under the terms of the GNU GPL v2.0.
*/
#if QT_VERSION < 0x040000
#include <qlistview.h>
#if QT_VERSION >= 300
#include <qsettings.h>
#else
class QSettings {
public:
void beginGroup(const QString& group) { }
void endGroup(void) { }
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QStringList readListEntry(const QString& key, bool* ok = 0) const
{ if (ok) *ok = FALSE; return QStringList(); }
template <class t>
bool writeEntry(const QString& key, t value)
{ return TRUE; }
};
#include <q3listview.h>
#endif
#include <qsettings.h>
#if QT_VERSION < 0x040000
#define Q3ValueList QValueList
#define Q3PopupMenu QPopupMenu
#define Q3ListView QListView
#define Q3ListViewItem QListViewItem
#define Q3VBox QVBox
#define Q3TextBrowser QTextBrowser
#define Q3MainWindow QMainWindow
#define Q3Action QAction
#define Q3ToolBar QToolBar
#define Q3ListViewItemIterator QListViewItemIterator
#define Q3FileDialog QFileDialog
#endif
class ConfigView;
......@@ -31,11 +30,10 @@ class ConfigItem;
class ConfigLineEdit;
class ConfigMainWindow;
class ConfigSettings : public QSettings {
public:
QValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const QValueList<int>& value);
Q3ValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const Q3ValueList<int>& value);
};
enum colIdx {
......@@ -48,9 +46,9 @@ enum optionMode {
normalOpt = 0, allOpt, promptOpt
};
class ConfigList : public QListView {
class ConfigList : public Q3ListView {
Q_OBJECT
typedef class QListView Parent;
typedef class Q3ListView Parent;
public:
ConfigList(ConfigView* p, const char *name = 0);
void reinit(void);
......@@ -135,17 +133,17 @@ public slots:
struct menu *rootEntry;
QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup;
QPopupMenu* headerPopup;
Q3PopupMenu* headerPopup;
private:
int colMap[colNr];
int colRevMap[colNr];
};
class ConfigItem : public QListViewItem {
typedef class QListViewItem Parent;
class ConfigItem : public Q3ListViewItem {
typedef class Q3ListViewItem Parent;
public:
ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
: Parent(parent, after), menu(m), visible(v), goParent(false)
{
init();
......@@ -155,16 +153,14 @@ class ConfigItem : public QListViewItem {
{
init();
}
ConfigItem(QListView *parent, ConfigItem *after, bool v)
ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
: Parent(parent, after), menu(0), visible(v), goParent(true)
{
init();
}
~ConfigItem(void);
void init(void);
#if QT_VERSION >= 300
void okRename(int col);
#endif
void updateMenu(void);
void testUpdateMenu(bool v);
ConfigList* listView() const
......@@ -219,9 +215,9 @@ class ConfigLineEdit : public QLineEdit {
ConfigItem *item;
};
class ConfigView : public QVBox {
class ConfigView : public Q3VBox {
Q_OBJECT
typedef class QVBox Parent;
typedef class Q3VBox Parent;
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
......@@ -252,9 +248,9 @@ public slots:
static QAction *showPromptAction;
};
class ConfigInfoView : public QTextBrowser {
class ConfigInfoView : public Q3TextBrowser {
Q_OBJECT
typedef class QTextBrowser Parent;
typedef class Q3TextBrowser Parent;
public:
ConfigInfoView(QWidget* parent, const char *name = 0);
bool showDebug(void) const { return _showDebug; }
......@@ -274,11 +270,11 @@ public slots:
QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str);
static void expr_print_help(void *data, struct symbol *sym, const char *str);
QPopupMenu* createPopupMenu(const QPoint& pos);
Q3PopupMenu* createPopupMenu(const QPoint& pos);
void contentsContextMenuEvent(QContextMenuEvent *e);
struct symbol *sym;
struct menu *menu;
struct menu *_menu;
bool _showDebug;
};
......@@ -302,10 +298,10 @@ public slots:
struct symbol **result;
};
class ConfigMainWindow : public QMainWindow {
class ConfigMainWindow : public Q3MainWindow {
Q_OBJECT
static QAction *saveAction;
static Q3Action *saveAction;
static void conf_changed(void);
public:
ConfigMainWindow(void);
......@@ -334,8 +330,8 @@ public slots:
ConfigView *configView;
ConfigList *configList;
ConfigInfoView *helpText;
QToolBar *toolBar;
QAction *backAction;
Q3ToolBar *toolBar;
Q3Action *backAction;
QSplitter* split1;
QSplitter* split2;
};
......@@ -350,7 +350,6 @@ void sym_calc_value(struct symbol *sym)
}
}
calc_newval:
#if 0
if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
fprintf(stderr, "warning: (");
expr_fprint(sym->rev_dep.expr, stderr);
......@@ -359,7 +358,6 @@ void sym_calc_value(struct symbol *sym)
expr_fprint(sym->dir_dep.expr, stderr);
fprintf(stderr, ")\n");
}
#endif
newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
}
if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
......@@ -842,6 +840,55 @@ struct symbol *sym_find(const char *name)
return symbol;
}
/*
* Expand symbol's names embedded in the string given in argument. Symbols'
* name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
* the empty string.
*/
const char *sym_expand_string_value(const char *in)
{
const char *src;
char *res;
size_t reslen;
reslen = strlen(in) + 1;
res = malloc(reslen);
res[0] = '\0';
while ((src = strchr(in, '$'))) {
char *p, name[SYMBOL_MAXLENGTH];
const char *symval = "";
struct symbol *sym;
size_t newlen;
strncat(res, in, src - in);
src++;
p = name;
while (isalnum(*src) || *src == '_')
*p++ = *src++;
*p = '\0';
sym = sym_find(name);
if (sym != NULL) {
sym_calc_value(sym);
symval = sym_get_string_value(sym);
}
newlen = strlen(res) + strlen(symval) + strlen(src);
if (newlen > reslen) {
reslen = newlen;
res = realloc(res, reslen);
}
strcat(res, symval);
in = src;
}
strcat(res, in);
return res;
}
struct symbol **sym_re_search(const char *pattern)
{
struct symbol *sym, **sym_arr = NULL;
......
......@@ -12,15 +12,18 @@
struct file *file_lookup(const char *name)
{
struct file *file;
const char *file_name = sym_expand_string_value(name);
for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name))
if (!strcmp(name, file->name)) {
free((void *)file_name);
return file;
}
}
file = malloc(sizeof(*file));
memset(file, 0, sizeof(*file));
file->name = strdup(name);
file->name = file_name;
file->next = file_list;
file_list = file;
return file;
......
......@@ -304,9 +304,10 @@ void zconf_nextfile(const char *name)
memset(buf, 0, sizeof(*buf));
current_buf->state = YY_CURRENT_BUFFER;
yyin = zconf_fopen(name);
yyin = zconf_fopen(file->name);
if (!yyin) {
printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
printf("%s:%d: can't open file \"%s\"\n",
zconf_curname(), zconf_lineno(), file->name);
exit(1);
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
......@@ -353,7 +354,7 @@ int zconf_lineno(void)
return current_pos.lineno;
}
char *zconf_curname(void)
const char *zconf_curname(void)
{
return current_pos.file ? current_pos.file->name : "<none>";
}
This diff is collapsed.
......@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
#define YYERROR_VERBOSE
#endif
%}
%expect 26
%expect 28
%union
{
......@@ -104,14 +104,15 @@ static struct menu *current_menu, *current_entry;
%}
%%
input: stmt_list;
input: nl start | start;
start: mainmenu_stmt stmt_list | stmt_list;
stmt_list:
/* empty */
| stmt_list common_stmt
| stmt_list choice_stmt
| stmt_list menu_stmt
| stmt_list T_MAINMENU prompt nl
| stmt_list end { zconf_error("unexpected end statement"); }
| stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
| stmt_list option_name error T_EOL
......@@ -342,6 +343,13 @@ if_block:
| if_block choice_stmt
;
/* mainmenu entry */
mainmenu_stmt: T_MAINMENU prompt nl
{
menu_add_prompt(P_MENU, $2, NULL);
};
/* menu entry */
menu: T_MENU prompt T_EOL
......@@ -494,6 +502,10 @@ void conf_parse(const char *name)
prop = prop_alloc(P_DEFAULT, modules_sym);
prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
}
rootmenu.prompt->text = _(rootmenu.prompt->text);
rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
menu_finalize(&rootmenu);
for_all_symbols(i, sym) {
if (sym_check_deps(sym))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment