Commit f3ae1c75 authored by Linus Torvalds's avatar Linus Torvalds

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

* 'kconfig-for-40' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  xconfig: merge code path to conf_write()
  kconfig: do not record timestamp in .config
  gconfig: Hide unused left treeview when start up the interface
  gconfig: enable rules hint for main treeviews
  MAINTAINERS: Update KCONFIG entry
  kconfig-language: add to hints
  kconfig: Document the new "visible if" syntax
  kconfig: quiet commands when V=0
  kconfig: change update-po-config to reflect new layout of arch/um
  kconfig: make update-po-config work in KBUILD_OUTPUT
  kconfig: rearrange clean-files
  kconfig: change gconf to modify hostprogs-y like nconf and mconf
  kconfig: change qconf to modify hostprogs-y like nconf and mconf
  kconfig: only build kxgettext when needed
  nconfig: Silence unused return values from wattrset
  kconfig: Do not record timestamp in auto.conf and autoconf.h
  kconfig: get rid of unused flags
  kconfig: allow multiple inclusion of the same file
  kconfig: Avoid buffer underrun in choice input
parents 9720d753 d49e4687
...@@ -3917,6 +3917,10 @@ S: Flandernstrasse 101 ...@@ -3917,6 +3917,10 @@ S: Flandernstrasse 101
S: D-73732 Esslingen S: D-73732 Esslingen
S: Germany S: Germany
N: Roman Zippel
E: zippel@linux-m68k.org
D: AFFS and HFS filesystems, m68k maintainer, new kernel configuration in 2.5
N: Leonard N. Zubkoff N: Leonard N. Zubkoff
W: http://www.dandelion.com/Linux/ W: http://www.dandelion.com/Linux/
D: BusLogic SCSI driver D: BusLogic SCSI driver
......
...@@ -113,6 +113,13 @@ applicable everywhere (see syntax). ...@@ -113,6 +113,13 @@ applicable everywhere (see syntax).
That will limit the usefulness but on the other hand avoid That will limit the usefulness but on the other hand avoid
the illegal configurations all over. the illegal configurations all over.
- limiting menu display: "visible if" <expr>
This attribute is only applicable to menu blocks, if the condition is
false, the menu block is not displayed to the user (the symbols
contained there can still be selected by other symbols, though). It is
similar to a conditional "prompt" attribude for individual menu
entries. Default value of "visible" is true.
- numerical ranges: "range" <symbol> <symbol> ["if" <expr>] - numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
This allows to limit the range of possible input values for int This allows to limit the range of possible input values for int
and hex symbols. The user can only input a value which is larger than and hex symbols. The user can only input a value which is larger than
...@@ -303,7 +310,8 @@ menu: ...@@ -303,7 +310,8 @@ menu:
"endmenu" "endmenu"
This defines a menu block, see "Menu structure" above for more This defines a menu block, see "Menu structure" above for more
information. The only possible options are dependencies. information. The only possible options are dependencies and "visible"
attributes.
if: if:
...@@ -381,3 +389,25 @@ config FOO ...@@ -381,3 +389,25 @@ config FOO
limits FOO to module (=m) or disabled (=n). limits FOO to module (=m) or disabled (=n).
Kconfig symbol existence
~~~~~~~~~~~~~~~~~~~~~~~~
The following two methods produce the same kconfig symbol dependencies
but differ greatly in kconfig symbol existence (production) in the
generated config file.
case 1:
config FOO
tristate "about foo"
depends on BAR
vs. case 2:
if BAR
config FOO
tristate "about foo"
endif
In case 1, the symbol FOO will always exist in the config file (given
no other dependencies). In case 2, the symbol FOO will only exist in
the config file if BAR is enabled.
...@@ -48,11 +48,6 @@ KCONFIG_OVERWRITECONFIG ...@@ -48,11 +48,6 @@ KCONFIG_OVERWRITECONFIG
If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
break symlinks when .config is a symlink to somewhere else. break symlinks when .config is a symlink to somewhere else.
KCONFIG_NOTIMESTAMP
--------------------------------------------------
If this environment variable exists and is non-null, the timestamp line
in generated .config files is omitted.
______________________________________________________________________ ______________________________________________________________________
Environment variables for '{allyes/allmod/allno/rand}config' Environment variables for '{allyes/allmod/allno/rand}config'
......
...@@ -3597,10 +3597,9 @@ F: Documentation/hwmon/k8temp ...@@ -3597,10 +3597,9 @@ F: Documentation/hwmon/k8temp
F: drivers/hwmon/k8temp.c F: drivers/hwmon/k8temp.c
KCONFIG KCONFIG
M: Roman Zippel <zippel@linux-m68k.org> M: Michal Marek <mmarek@suse.cz>
L: linux-kbuild@vger.kernel.org L: linux-kbuild@vger.kernel.org
Q: http://patchwork.kernel.org/project/linux-kbuild/list/ S: Odd Fixes
S: Maintained
F: Documentation/kbuild/kconfig-language.txt F: Documentation/kbuild/kconfig-language.txt
F: scripts/kconfig/ F: scripts/kconfig/
......
...@@ -77,14 +77,15 @@ localyesconfig: $(obj)/streamline_config.pl $(obj)/conf ...@@ -77,14 +77,15 @@ localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
# The symlink is used to repair a deficiency in arch/um # The symlink is used to repair a deficiency in arch/um
update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
$(Q)echo " GEN config" $(Q)echo " GEN config"
$(Q)xgettext --default-domain=linux \ $(Q)xgettext --default-domain=linux \
--add-comments --keyword=_ --keyword=N_ \ --add-comments --keyword=_ --keyword=N_ \
--from-code=UTF-8 \ --from-code=UTF-8 \
--files-from=scripts/kconfig/POTFILES.in \ --files-from=$(srctree)/scripts/kconfig/POTFILES.in \
--directory=$(srctree) --directory=$(objtree) \
--output $(obj)/config.pot --output $(obj)/config.pot
$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch $(Q)ln -fs Kconfig.x86 arch/um/Kconfig
$(Q)(for i in `ls arch/*/Kconfig`; \ $(Q)(for i in `ls $(srctree)/arch/*/Kconfig`; \
do \ do \
echo " GEN $$i"; \ echo " GEN $$i"; \
$(obj)/kxgettext $$i \ $(obj)/kxgettext $$i \
...@@ -92,7 +93,7 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h ...@@ -92,7 +93,7 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
done ) done )
$(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
--output $(obj)/linux.pot --output $(obj)/linux.pot
$(Q)rm -f arch/um/Kconfig.arch $(Q)rm -f $(srctree)/arch/um/Kconfig
$(Q)rm -f $(obj)/config.pot $(Q)rm -f $(obj)/config.pot
PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
...@@ -168,8 +169,11 @@ conf-objs := conf.o zconf.tab.o ...@@ -168,8 +169,11 @@ conf-objs := conf.o zconf.tab.o
mconf-objs := mconf.o zconf.tab.o $(lxdialog) mconf-objs := mconf.o zconf.tab.o $(lxdialog)
nconf-objs := nconf.o zconf.tab.o nconf.gui.o nconf-objs := nconf.o zconf.tab.o nconf.gui.o
kxgettext-objs := kxgettext.o zconf.tab.o kxgettext-objs := kxgettext.o zconf.tab.o
qconf-cxxobjs := qconf.o
qconf-objs := kconfig_load.o zconf.tab.o
gconf-objs := gconf.o kconfig_load.o zconf.tab.o
hostprogs-y := conf qconf gconf kxgettext hostprogs-y := conf
ifeq ($(MAKECMDGOALS),nconfig) ifeq ($(MAKECMDGOALS),nconfig)
hostprogs-y += nconf hostprogs-y += nconf
...@@ -179,6 +183,10 @@ ifeq ($(MAKECMDGOALS),menuconfig) ...@@ -179,6 +183,10 @@ ifeq ($(MAKECMDGOALS),menuconfig)
hostprogs-y += mconf hostprogs-y += mconf
endif endif
ifeq ($(MAKECMDGOALS),update-po-config)
hostprogs-y += kxgettext
endif
ifeq ($(MAKECMDGOALS),xconfig) ifeq ($(MAKECMDGOALS),xconfig)
qconf-target := 1 qconf-target := 1
endif endif
...@@ -188,16 +196,15 @@ endif ...@@ -188,16 +196,15 @@ endif
ifeq ($(qconf-target),1) ifeq ($(qconf-target),1)
qconf-cxxobjs := qconf.o hostprogs-y += qconf
qconf-objs := kconfig_load.o zconf.tab.o
endif endif
ifeq ($(gconf-target),1) ifeq ($(gconf-target),1)
gconf-objs := gconf.o kconfig_load.o zconf.tab.o hostprogs-y += gconf
endif endif
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf nconf clean-files += mconf qconf gconf nconf
clean-files += config.pot linux.pot clean-files += config.pot linux.pot
...@@ -321,11 +328,12 @@ $(obj)/%.moc: $(src)/%.h ...@@ -321,11 +328,12 @@ $(obj)/%.moc: $(src)/%.h
$(KC_QT_MOC) -i $< -o $@ $(KC_QT_MOC) -i $< -o $@
$(obj)/lkc_defs.h: $(src)/lkc_proto.h $(obj)/lkc_defs.h: $(src)/lkc_proto.h
sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
# Extract gconf menu items for I18N support # Extract gconf menu items for I18N support
$(obj)/gconf.glade.h: $(obj)/gconf.glade $(obj)/gconf.glade.h: $(obj)/gconf.glade
intltool-extract --type=gettext/glade $(obj)/gconf.glade $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
$(obj)/gconf.glade
### ###
# The following requires flex/bison/gperf # The following requires flex/bison/gperf
......
...@@ -560,8 +560,6 @@ int conf_write(const char *name) ...@@ -560,8 +560,6 @@ int conf_write(const char *name)
const char *basename; const char *basename;
const char *str; const char *str;
char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1]; char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
time_t now;
int use_timestamp = 1;
char *env; char *env;
dirname[0] = 0; dirname[0] = 0;
...@@ -598,19 +596,11 @@ int conf_write(const char *name) ...@@ -598,19 +596,11 @@ int conf_write(const char *name)
if (!out) if (!out)
return 1; return 1;
time(&now);
env = getenv("KCONFIG_NOTIMESTAMP");
if (env && *env)
use_timestamp = 0;
fprintf(out, _("#\n" fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
"# %s\n" "# %s\n"
"%s%s"
"#\n"), "#\n"),
rootmenu.prompt->text, rootmenu.prompt->text);
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
if (!conf_get_changed()) if (!conf_get_changed())
sym_clear_all_valid(); sym_clear_all_valid();
...@@ -784,7 +774,6 @@ int conf_write_autoconf(void) ...@@ -784,7 +774,6 @@ int conf_write_autoconf(void)
const char *str; const char *str;
const char *name; const char *name;
FILE *out, *tristate, *out_h; FILE *out, *tristate, *out_h;
time_t now;
int i; int i;
sym_clear_all_valid(); sym_clear_all_valid();
...@@ -811,22 +800,19 @@ int conf_write_autoconf(void) ...@@ -811,22 +800,19 @@ int conf_write_autoconf(void)
return 1; return 1;
} }
time(&now);
fprintf(out, "#\n" fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
"# %s\n" "# %s\n"
"# %s"
"#\n", "#\n",
rootmenu.prompt->text, ctime(&now)); rootmenu.prompt->text);
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"
" * %s\n" " * %s\n"
" * %s"
" */\n", " */\n",
rootmenu.prompt->text, ctime(&now)); rootmenu.prompt->text);
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
sym_calc_value(sym); sym_calc_value(sym);
......
...@@ -20,12 +20,8 @@ struct file { ...@@ -20,12 +20,8 @@ struct file {
struct file *parent; struct file *parent;
const char *name; const char *name;
int lineno; int lineno;
int flags;
}; };
#define FILE_BUSY 0x0001
#define FILE_SCANNED 0x0002
typedef enum tristate { typedef enum tristate {
no, mod, yes no, mod, yes
} tristate; } tristate;
......
...@@ -253,7 +253,7 @@ void init_left_tree(void) ...@@ -253,7 +253,7 @@ void init_left_tree(void)
gtk_tree_view_set_model(view, model1); gtk_tree_view_set_model(view, model1);
gtk_tree_view_set_headers_visible(view, TRUE); gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE); gtk_tree_view_set_rules_hint(view, TRUE);
column = gtk_tree_view_column_new(); column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column); gtk_tree_view_append_column(view, column);
...@@ -298,7 +298,7 @@ void init_right_tree(void) ...@@ -298,7 +298,7 @@ void init_right_tree(void)
gtk_tree_view_set_model(view, model2); gtk_tree_view_set_model(view, model2);
gtk_tree_view_set_headers_visible(view, TRUE); gtk_tree_view_set_headers_visible(view, TRUE);
gtk_tree_view_set_rules_hint(view, FALSE); gtk_tree_view_set_rules_hint(view, TRUE);
column = gtk_tree_view_column_new(); column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column); gtk_tree_view_append_column(view, column);
...@@ -756,7 +756,6 @@ void on_load_clicked(GtkButton * button, gpointer user_data) ...@@ -756,7 +756,6 @@ void on_load_clicked(GtkButton * button, gpointer user_data)
void on_single_clicked(GtkButton * button, gpointer user_data) void on_single_clicked(GtkButton * button, gpointer user_data)
{ {
view_mode = SINGLE_VIEW; view_mode = SINGLE_VIEW;
gtk_paned_set_position(GTK_PANED(hpaned), 0);
gtk_widget_hide(tree1_w); gtk_widget_hide(tree1_w);
current = &rootmenu; current = &rootmenu;
display_tree_part(); display_tree_part();
...@@ -782,7 +781,6 @@ void on_split_clicked(GtkButton * button, gpointer user_data) ...@@ -782,7 +781,6 @@ void on_split_clicked(GtkButton * button, gpointer user_data)
void on_full_clicked(GtkButton * button, gpointer user_data) void on_full_clicked(GtkButton * button, gpointer user_data)
{ {
view_mode = FULL_VIEW; view_mode = FULL_VIEW;
gtk_paned_set_position(GTK_PANED(hpaned), 0);
gtk_widget_hide(tree1_w); gtk_widget_hide(tree1_w);
if (tree2) if (tree2)
gtk_tree_store_clear(tree2); gtk_tree_store_clear(tree2);
...@@ -1444,6 +1442,12 @@ static void display_tree(struct menu *menu) ...@@ -1444,6 +1442,12 @@ static void display_tree(struct menu *menu)
if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
|| (view_mode == FULL_VIEW) || (view_mode == FULL_VIEW)
|| (view_mode == SPLIT_VIEW))*/ || (view_mode == SPLIT_VIEW))*/
/* Change paned position if the view is not in 'split mode' */
if (view_mode == SINGLE_VIEW || view_mode == FULL_VIEW) {
gtk_paned_set_position(GTK_PANED(hpaned), 0);
}
if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT))
|| (view_mode == FULL_VIEW) || (view_mode == FULL_VIEW)
|| (view_mode == SPLIT_VIEW)) { || (view_mode == SPLIT_VIEW)) {
......
...@@ -2363,11 +2363,11 @@ void zconf_initscan(const char *name) ...@@ -2363,11 +2363,11 @@ void zconf_initscan(const char *name)
current_file = file_lookup(name); current_file = file_lookup(name);
current_file->lineno = 1; current_file->lineno = 1;
current_file->flags = FILE_BUSY;
} }
void zconf_nextfile(const char *name) void zconf_nextfile(const char *name)
{ {
struct file *iter;
struct file *file = file_lookup(name); struct file *file = file_lookup(name);
struct buffer *buf = malloc(sizeof(*buf)); struct buffer *buf = malloc(sizeof(*buf));
memset(buf, 0, sizeof(*buf)); memset(buf, 0, sizeof(*buf));
...@@ -2383,18 +2383,25 @@ void zconf_nextfile(const char *name) ...@@ -2383,18 +2383,25 @@ void zconf_nextfile(const char *name)
buf->parent = current_buf; buf->parent = current_buf;
current_buf = buf; current_buf = buf;
if (file->flags & FILE_BUSY) { for (iter = current_file->parent; iter; iter = iter->parent ) {
printf("%s:%d: do not source '%s' from itself\n", if (!strcmp(current_file->name,iter->name) ) {
zconf_curname(), zconf_lineno(), name); printf("%s:%d: recursive inclusion detected. "
exit(1); "Inclusion path:\n current file : '%s'\n",
} zconf_curname(), zconf_lineno(),
if (file->flags & FILE_SCANNED) { zconf_curname());
printf("%s:%d: file '%s' is already sourced from '%s'\n", iter = current_file->parent;
zconf_curname(), zconf_lineno(), name, while (iter && \
file->parent->name); strcmp(iter->name,current_file->name)) {
exit(1); printf(" included from: '%s:%d'\n",
iter->name, iter->lineno-1);
iter = iter->parent;
}
if (iter)
printf(" included from: '%s:%d'\n",
iter->name, iter->lineno+1);
exit(1);
}
} }
file->flags |= FILE_BUSY;
file->lineno = 1; file->lineno = 1;
file->parent = current_file; file->parent = current_file;
current_file = file; current_file = file;
...@@ -2404,8 +2411,6 @@ static void zconf_endfile(void) ...@@ -2404,8 +2411,6 @@ static void zconf_endfile(void)
{ {
struct buffer *parent; struct buffer *parent;
current_file->flags |= FILE_SCANNED;
current_file->flags &= ~FILE_BUSY;
current_file = current_file->parent; current_file = current_file->parent;
parent = current_buf->parent; parent = current_buf->parent;
......
...@@ -373,18 +373,18 @@ static void print_function_line(void) ...@@ -373,18 +373,18 @@ static void print_function_line(void)
const int skip = 1; const int skip = 1;
for (i = 0; i < function_keys_num; i++) { for (i = 0; i < function_keys_num; i++) {
wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
mvwprintw(main_window, LINES-3, offset, mvwprintw(main_window, LINES-3, offset,
"%s", "%s",
function_keys[i].key_str); function_keys[i].key_str);
wattrset(main_window, attributes[FUNCTION_TEXT]); (void) wattrset(main_window, attributes[FUNCTION_TEXT]);
offset += strlen(function_keys[i].key_str); offset += strlen(function_keys[i].key_str);
mvwprintw(main_window, LINES-3, mvwprintw(main_window, LINES-3,
offset, "%s", offset, "%s",
function_keys[i].func); function_keys[i].func);
offset += strlen(function_keys[i].func) + skip; offset += strlen(function_keys[i].func) + skip;
} }
wattrset(main_window, attributes[NORMAL]); (void) wattrset(main_window, attributes[NORMAL]);
} }
/* help */ /* help */
...@@ -953,16 +953,16 @@ static void show_menu(const char *prompt, const char *instructions, ...@@ -953,16 +953,16 @@ static void show_menu(const char *prompt, const char *instructions,
current_instructions = instructions; current_instructions = instructions;
clear(); clear();
wattrset(main_window, attributes[NORMAL]); (void) wattrset(main_window, attributes[NORMAL]);
print_in_middle(stdscr, 1, 0, COLS, print_in_middle(stdscr, 1, 0, COLS,
menu_backtitle, menu_backtitle,
attributes[MAIN_HEADING]); attributes[MAIN_HEADING]);
wattrset(main_window, attributes[MAIN_MENU_BOX]); (void) wattrset(main_window, attributes[MAIN_MENU_BOX]);
box(main_window, 0, 0); box(main_window, 0, 0);
wattrset(main_window, attributes[MAIN_MENU_HEADING]); (void) wattrset(main_window, attributes[MAIN_MENU_HEADING]);
mvwprintw(main_window, 0, 3, " %s ", prompt); mvwprintw(main_window, 0, 3, " %s ", prompt);
wattrset(main_window, attributes[NORMAL]); (void) wattrset(main_window, attributes[NORMAL]);
set_menu_items(curses_menu, curses_menu_items); set_menu_items(curses_menu, curses_menu_items);
......
...@@ -1489,8 +1489,7 @@ void ConfigMainWindow::saveConfigAs(void) ...@@ -1489,8 +1489,7 @@ void ConfigMainWindow::saveConfigAs(void)
QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
if (s.isNull()) if (s.isNull())
return; return;
if (conf_write(QFile::encodeName(s))) saveConfig();
QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
} }
void ConfigMainWindow::searchConfig(void) void ConfigMainWindow::searchConfig(void)
...@@ -1643,7 +1642,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) ...@@ -1643,7 +1642,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
switch (mb.exec()) { switch (mb.exec()) {
case QMessageBox::Yes: case QMessageBox::Yes:
conf_write(NULL); saveConfig();
case QMessageBox::No: case QMessageBox::No:
e->accept(); e->accept();
break; break;
......
...@@ -294,11 +294,11 @@ void zconf_initscan(const char *name) ...@@ -294,11 +294,11 @@ void zconf_initscan(const char *name)
current_file = file_lookup(name); current_file = file_lookup(name);
current_file->lineno = 1; current_file->lineno = 1;
current_file->flags = FILE_BUSY;
} }
void zconf_nextfile(const char *name) void zconf_nextfile(const char *name)
{ {
struct file *iter;
struct file *file = file_lookup(name); struct file *file = file_lookup(name);
struct buffer *buf = malloc(sizeof(*buf)); struct buffer *buf = malloc(sizeof(*buf));
memset(buf, 0, sizeof(*buf)); memset(buf, 0, sizeof(*buf));
...@@ -314,18 +314,25 @@ void zconf_nextfile(const char *name) ...@@ -314,18 +314,25 @@ void zconf_nextfile(const char *name)
buf->parent = current_buf; buf->parent = current_buf;
current_buf = buf; current_buf = buf;
if (file->flags & FILE_BUSY) { for (iter = current_file->parent; iter; iter = iter->parent ) {
printf("%s:%d: do not source '%s' from itself\n", if (!strcmp(current_file->name,iter->name) ) {
zconf_curname(), zconf_lineno(), name); printf("%s:%d: recursive inclusion detected. "
exit(1); "Inclusion path:\n current file : '%s'\n",
} zconf_curname(), zconf_lineno(),
if (file->flags & FILE_SCANNED) { zconf_curname());
printf("%s:%d: file '%s' is already sourced from '%s'\n", iter = current_file->parent;
zconf_curname(), zconf_lineno(), name, while (iter && \
file->parent->name); strcmp(iter->name,current_file->name)) {
exit(1); printf(" included from: '%s:%d'\n",
iter->name, iter->lineno-1);
iter = iter->parent;
}
if (iter)
printf(" included from: '%s:%d'\n",
iter->name, iter->lineno+1);
exit(1);
}
} }
file->flags |= FILE_BUSY;
file->lineno = 1; file->lineno = 1;
file->parent = current_file; file->parent = current_file;
current_file = file; current_file = file;
...@@ -335,8 +342,6 @@ static void zconf_endfile(void) ...@@ -335,8 +342,6 @@ static void zconf_endfile(void)
{ {
struct buffer *parent; struct buffer *parent;
current_file->flags |= FILE_SCANNED;
current_file->flags &= ~FILE_BUSY;
current_file = current_file->parent; current_file = current_file->parent;
parent = current_buf->parent; parent = current_buf->parent;
......
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