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