aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 19:54:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 19:54:01 -0400
commitf3ae1c75203535f65448517e46c8dd70a56b6c71 (patch)
tree58f719cb97666dcfb3392c6c0547d6cbce2e68c8 /scripts
parent9720d75399fd2655a6b6fb06abcf548150f22362 (diff)
parentd49e46875c11a09e80e76c66db90710369b8fe12 (diff)
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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile38
-rw-r--r--scripts/kconfig/confdata.c20
-rw-r--r--scripts/kconfig/expr.h4
-rw-r--r--scripts/kconfig/gconf.c12
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped33
-rw-r--r--scripts/kconfig/nconf.c14
-rw-r--r--scripts/kconfig/qconf.cc5
-rw-r--r--scripts/kconfig/zconf.l33
8 files changed, 81 insertions, 78 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 368ae306aee4..faa9a4701b6f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -77,14 +77,15 @@ localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
77# The symlink is used to repair a deficiency in arch/um 77# The symlink is used to repair a deficiency in arch/um
78update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h 78update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
79 $(Q)echo " GEN config" 79 $(Q)echo " GEN config"
80 $(Q)xgettext --default-domain=linux \ 80 $(Q)xgettext --default-domain=linux \
81 --add-comments --keyword=_ --keyword=N_ \ 81 --add-comments --keyword=_ --keyword=N_ \
82 --from-code=UTF-8 \ 82 --from-code=UTF-8 \
83 --files-from=scripts/kconfig/POTFILES.in \ 83 --files-from=$(srctree)/scripts/kconfig/POTFILES.in \
84 --directory=$(srctree) --directory=$(objtree) \
84 --output $(obj)/config.pot 85 --output $(obj)/config.pot
85 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot 86 $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
86 $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch 87 $(Q)ln -fs Kconfig.x86 arch/um/Kconfig
87 $(Q)(for i in `ls arch/*/Kconfig`; \ 88 $(Q)(for i in `ls $(srctree)/arch/*/Kconfig`; \
88 do \ 89 do \
89 echo " GEN $$i"; \ 90 echo " GEN $$i"; \
90 $(obj)/kxgettext $$i \ 91 $(obj)/kxgettext $$i \
@@ -92,7 +93,7 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h
92 done ) 93 done )
93 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ 94 $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
94 --output $(obj)/linux.pot 95 --output $(obj)/linux.pot
95 $(Q)rm -f arch/um/Kconfig.arch 96 $(Q)rm -f $(srctree)/arch/um/Kconfig
96 $(Q)rm -f $(obj)/config.pot 97 $(Q)rm -f $(obj)/config.pot
97 98
98PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig 99PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig
@@ -168,8 +169,11 @@ conf-objs := conf.o zconf.tab.o
168mconf-objs := mconf.o zconf.tab.o $(lxdialog) 169mconf-objs := mconf.o zconf.tab.o $(lxdialog)
169nconf-objs := nconf.o zconf.tab.o nconf.gui.o 170nconf-objs := nconf.o zconf.tab.o nconf.gui.o
170kxgettext-objs := kxgettext.o zconf.tab.o 171kxgettext-objs := kxgettext.o zconf.tab.o
172qconf-cxxobjs := qconf.o
173qconf-objs := kconfig_load.o zconf.tab.o
174gconf-objs := gconf.o kconfig_load.o zconf.tab.o
171 175
172hostprogs-y := conf qconf gconf kxgettext 176hostprogs-y := conf
173 177
174ifeq ($(MAKECMDGOALS),nconfig) 178ifeq ($(MAKECMDGOALS),nconfig)
175 hostprogs-y += nconf 179 hostprogs-y += nconf
@@ -179,6 +183,10 @@ ifeq ($(MAKECMDGOALS),menuconfig)
179 hostprogs-y += mconf 183 hostprogs-y += mconf
180endif 184endif
181 185
186ifeq ($(MAKECMDGOALS),update-po-config)
187 hostprogs-y += kxgettext
188endif
189
182ifeq ($(MAKECMDGOALS),xconfig) 190ifeq ($(MAKECMDGOALS),xconfig)
183 qconf-target := 1 191 qconf-target := 1
184endif 192endif
@@ -188,16 +196,15 @@ endif
188 196
189 197
190ifeq ($(qconf-target),1) 198ifeq ($(qconf-target),1)
191qconf-cxxobjs := qconf.o 199 hostprogs-y += qconf
192qconf-objs := kconfig_load.o zconf.tab.o
193endif 200endif
194 201
195ifeq ($(gconf-target),1) 202ifeq ($(gconf-target),1)
196gconf-objs := gconf.o kconfig_load.o zconf.tab.o 203 hostprogs-y += gconf
197endif 204endif
198 205
199clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 206clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck
200 .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h 207clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
201clean-files += mconf qconf gconf nconf 208clean-files += mconf qconf gconf nconf
202clean-files += config.pot linux.pot 209clean-files += config.pot linux.pot
203 210
@@ -321,11 +328,12 @@ $(obj)/%.moc: $(src)/%.h
321 $(KC_QT_MOC) -i $< -o $@ 328 $(KC_QT_MOC) -i $< -o $@
322 329
323$(obj)/lkc_defs.h: $(src)/lkc_proto.h 330$(obj)/lkc_defs.h: $(src)/lkc_proto.h
324 sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' 331 $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
325 332
326# Extract gconf menu items for I18N support 333# Extract gconf menu items for I18N support
327$(obj)/gconf.glade.h: $(obj)/gconf.glade 334$(obj)/gconf.glade.h: $(obj)/gconf.glade
328 intltool-extract --type=gettext/glade $(obj)/gconf.glade 335 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
336 $(obj)/gconf.glade
329 337
330### 338###
331# The following requires flex/bison/gperf 339# The following requires flex/bison/gperf
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 61c35bf2d9cb..2bafd9a7c8da 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -560,8 +560,6 @@ int conf_write(const char *name)
560 const char *basename; 560 const char *basename;
561 const char *str; 561 const char *str;
562 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1]; 562 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
563 time_t now;
564 int use_timestamp = 1;
565 char *env; 563 char *env;
566 564
567 dirname[0] = 0; 565 dirname[0] = 0;
@@ -598,19 +596,11 @@ int conf_write(const char *name)
598 if (!out) 596 if (!out)
599 return 1; 597 return 1;
600 598
601 time(&now);
602 env = getenv("KCONFIG_NOTIMESTAMP");
603 if (env && *env)
604 use_timestamp = 0;
605
606 fprintf(out, _("#\n" 599 fprintf(out, _("#\n"
607 "# Automatically generated make config: don't edit\n" 600 "# Automatically generated make config: don't edit\n"
608 "# %s\n" 601 "# %s\n"
609 "%s%s"
610 "#\n"), 602 "#\n"),
611 rootmenu.prompt->text, 603 rootmenu.prompt->text);
612 use_timestamp ? "# " : "",
613 use_timestamp ? ctime(&now) : "");
614 604
615 if (!conf_get_changed()) 605 if (!conf_get_changed())
616 sym_clear_all_valid(); 606 sym_clear_all_valid();
@@ -784,7 +774,6 @@ int conf_write_autoconf(void)
784 const char *str; 774 const char *str;
785 const char *name; 775 const char *name;
786 FILE *out, *tristate, *out_h; 776 FILE *out, *tristate, *out_h;
787 time_t now;
788 int i; 777 int i;
789 778
790 sym_clear_all_valid(); 779 sym_clear_all_valid();
@@ -811,22 +800,19 @@ int conf_write_autoconf(void)
811 return 1; 800 return 1;
812 } 801 }
813 802
814 time(&now);
815 fprintf(out, "#\n" 803 fprintf(out, "#\n"
816 "# Automatically generated make config: don't edit\n" 804 "# Automatically generated make config: don't edit\n"
817 "# %s\n" 805 "# %s\n"
818 "# %s"
819 "#\n", 806 "#\n",
820 rootmenu.prompt->text, ctime(&now)); 807 rootmenu.prompt->text);
821 fprintf(tristate, "#\n" 808 fprintf(tristate, "#\n"
822 "# Automatically generated - do not edit\n" 809 "# Automatically generated - do not edit\n"
823 "\n"); 810 "\n");
824 fprintf(out_h, "/*\n" 811 fprintf(out_h, "/*\n"
825 " * Automatically generated C config: don't edit\n" 812 " * Automatically generated C config: don't edit\n"
826 " * %s\n" 813 " * %s\n"
827 " * %s"
828 " */\n", 814 " */\n",
829 rootmenu.prompt->text, ctime(&now)); 815 rootmenu.prompt->text);
830 816
831 for_all_symbols(i, sym) { 817 for_all_symbols(i, sym) {
832 sym_calc_value(sym); 818 sym_calc_value(sym);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 3d238db49764..16bfae2d3217 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -20,12 +20,8 @@ struct file {
20 struct file *parent; 20 struct file *parent;
21 const char *name; 21 const char *name;
22 int lineno; 22 int lineno;
23 int flags;
24}; 23};
25 24
26#define FILE_BUSY 0x0001
27#define FILE_SCANNED 0x0002
28
29typedef enum tristate { 25typedef enum tristate {
30 no, mod, yes 26 no, mod, yes
31} tristate; 27} tristate;
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 455896164d72..a11d5f7b9eeb 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -253,7 +253,7 @@ void init_left_tree(void)
253 253
254 gtk_tree_view_set_model(view, model1); 254 gtk_tree_view_set_model(view, model1);
255 gtk_tree_view_set_headers_visible(view, TRUE); 255 gtk_tree_view_set_headers_visible(view, TRUE);
256 gtk_tree_view_set_rules_hint(view, FALSE); 256 gtk_tree_view_set_rules_hint(view, TRUE);
257 257
258 column = gtk_tree_view_column_new(); 258 column = gtk_tree_view_column_new();
259 gtk_tree_view_append_column(view, column); 259 gtk_tree_view_append_column(view, column);
@@ -298,7 +298,7 @@ void init_right_tree(void)
298 298
299 gtk_tree_view_set_model(view, model2); 299 gtk_tree_view_set_model(view, model2);
300 gtk_tree_view_set_headers_visible(view, TRUE); 300 gtk_tree_view_set_headers_visible(view, TRUE);
301 gtk_tree_view_set_rules_hint(view, FALSE); 301 gtk_tree_view_set_rules_hint(view, TRUE);
302 302
303 column = gtk_tree_view_column_new(); 303 column = gtk_tree_view_column_new();
304 gtk_tree_view_append_column(view, column); 304 gtk_tree_view_append_column(view, column);
@@ -756,7 +756,6 @@ void on_load_clicked(GtkButton * button, gpointer user_data)
756void on_single_clicked(GtkButton * button, gpointer user_data) 756void on_single_clicked(GtkButton * button, gpointer user_data)
757{ 757{
758 view_mode = SINGLE_VIEW; 758 view_mode = SINGLE_VIEW;
759 gtk_paned_set_position(GTK_PANED(hpaned), 0);
760 gtk_widget_hide(tree1_w); 759 gtk_widget_hide(tree1_w);
761 current = &rootmenu; 760 current = &rootmenu;
762 display_tree_part(); 761 display_tree_part();
@@ -782,7 +781,6 @@ void on_split_clicked(GtkButton * button, gpointer user_data)
782void on_full_clicked(GtkButton * button, gpointer user_data) 781void on_full_clicked(GtkButton * button, gpointer user_data)
783{ 782{
784 view_mode = FULL_VIEW; 783 view_mode = FULL_VIEW;
785 gtk_paned_set_position(GTK_PANED(hpaned), 0);
786 gtk_widget_hide(tree1_w); 784 gtk_widget_hide(tree1_w);
787 if (tree2) 785 if (tree2)
788 gtk_tree_store_clear(tree2); 786 gtk_tree_store_clear(tree2);
@@ -1444,6 +1442,12 @@ static void display_tree(struct menu *menu)
1444 if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) 1442 if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT))
1445 || (view_mode == FULL_VIEW) 1443 || (view_mode == FULL_VIEW)
1446 || (view_mode == SPLIT_VIEW))*/ 1444 || (view_mode == SPLIT_VIEW))*/
1445
1446 /* Change paned position if the view is not in 'split mode' */
1447 if (view_mode == SINGLE_VIEW || view_mode == FULL_VIEW) {
1448 gtk_paned_set_position(GTK_PANED(hpaned), 0);
1449 }
1450
1447 if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) 1451 if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT))
1448 || (view_mode == FULL_VIEW) 1452 || (view_mode == FULL_VIEW)
1449 || (view_mode == SPLIT_VIEW)) { 1453 || (view_mode == SPLIT_VIEW)) {
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index 6eb039718259..d9182916f724 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2363,11 +2363,11 @@ void zconf_initscan(const char *name)
2363 2363
2364 current_file = file_lookup(name); 2364 current_file = file_lookup(name);
2365 current_file->lineno = 1; 2365 current_file->lineno = 1;
2366 current_file->flags = FILE_BUSY;
2367} 2366}
2368 2367
2369void zconf_nextfile(const char *name) 2368void zconf_nextfile(const char *name)
2370{ 2369{
2370 struct file *iter;
2371 struct file *file = file_lookup(name); 2371 struct file *file = file_lookup(name);
2372 struct buffer *buf = malloc(sizeof(*buf)); 2372 struct buffer *buf = malloc(sizeof(*buf));
2373 memset(buf, 0, sizeof(*buf)); 2373 memset(buf, 0, sizeof(*buf));
@@ -2383,18 +2383,25 @@ void zconf_nextfile(const char *name)
2383 buf->parent = current_buf; 2383 buf->parent = current_buf;
2384 current_buf = buf; 2384 current_buf = buf;
2385 2385
2386 if (file->flags & FILE_BUSY) { 2386 for (iter = current_file->parent; iter; iter = iter->parent ) {
2387 printf("%s:%d: do not source '%s' from itself\n", 2387 if (!strcmp(current_file->name,iter->name) ) {
2388 zconf_curname(), zconf_lineno(), name); 2388 printf("%s:%d: recursive inclusion detected. "
2389 exit(1); 2389 "Inclusion path:\n current file : '%s'\n",
2390 } 2390 zconf_curname(), zconf_lineno(),
2391 if (file->flags & FILE_SCANNED) { 2391 zconf_curname());
2392 printf("%s:%d: file '%s' is already sourced from '%s'\n", 2392 iter = current_file->parent;
2393 zconf_curname(), zconf_lineno(), name, 2393 while (iter && \
2394 file->parent->name); 2394 strcmp(iter->name,current_file->name)) {
2395 exit(1); 2395 printf(" included from: '%s:%d'\n",
2396 iter->name, iter->lineno-1);
2397 iter = iter->parent;
2398 }
2399 if (iter)
2400 printf(" included from: '%s:%d'\n",
2401 iter->name, iter->lineno+1);
2402 exit(1);
2403 }
2396 } 2404 }
2397 file->flags |= FILE_BUSY;
2398 file->lineno = 1; 2405 file->lineno = 1;
2399 file->parent = current_file; 2406 file->parent = current_file;
2400 current_file = file; 2407 current_file = file;
@@ -2404,8 +2411,6 @@ static void zconf_endfile(void)
2404{ 2411{
2405 struct buffer *parent; 2412 struct buffer *parent;
2406 2413
2407 current_file->flags |= FILE_SCANNED;
2408 current_file->flags &= ~FILE_BUSY;
2409 current_file = current_file->parent; 2414 current_file = current_file->parent;
2410 2415
2411 parent = current_buf->parent; 2416 parent = current_buf->parent;
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index db56377393d7..488dd7410787 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -373,18 +373,18 @@ static void print_function_line(void)
373 const int skip = 1; 373 const int skip = 1;
374 374
375 for (i = 0; i < function_keys_num; i++) { 375 for (i = 0; i < function_keys_num; i++) {
376 wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); 376 (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]);
377 mvwprintw(main_window, LINES-3, offset, 377 mvwprintw(main_window, LINES-3, offset,
378 "%s", 378 "%s",
379 function_keys[i].key_str); 379 function_keys[i].key_str);
380 wattrset(main_window, attributes[FUNCTION_TEXT]); 380 (void) wattrset(main_window, attributes[FUNCTION_TEXT]);
381 offset += strlen(function_keys[i].key_str); 381 offset += strlen(function_keys[i].key_str);
382 mvwprintw(main_window, LINES-3, 382 mvwprintw(main_window, LINES-3,
383 offset, "%s", 383 offset, "%s",
384 function_keys[i].func); 384 function_keys[i].func);
385 offset += strlen(function_keys[i].func) + skip; 385 offset += strlen(function_keys[i].func) + skip;
386 } 386 }
387 wattrset(main_window, attributes[NORMAL]); 387 (void) wattrset(main_window, attributes[NORMAL]);
388} 388}
389 389
390/* help */ 390/* help */
@@ -953,16 +953,16 @@ static void show_menu(const char *prompt, const char *instructions,
953 current_instructions = instructions; 953 current_instructions = instructions;
954 954
955 clear(); 955 clear();
956 wattrset(main_window, attributes[NORMAL]); 956 (void) wattrset(main_window, attributes[NORMAL]);
957 print_in_middle(stdscr, 1, 0, COLS, 957 print_in_middle(stdscr, 1, 0, COLS,
958 menu_backtitle, 958 menu_backtitle,
959 attributes[MAIN_HEADING]); 959 attributes[MAIN_HEADING]);
960 960
961 wattrset(main_window, attributes[MAIN_MENU_BOX]); 961 (void) wattrset(main_window, attributes[MAIN_MENU_BOX]);
962 box(main_window, 0, 0); 962 box(main_window, 0, 0);
963 wattrset(main_window, attributes[MAIN_MENU_HEADING]); 963 (void) wattrset(main_window, attributes[MAIN_MENU_HEADING]);
964 mvwprintw(main_window, 0, 3, " %s ", prompt); 964 mvwprintw(main_window, 0, 3, " %s ", prompt);
965 wattrset(main_window, attributes[NORMAL]); 965 (void) wattrset(main_window, attributes[NORMAL]);
966 966
967 set_menu_items(curses_menu, curses_menu_items); 967 set_menu_items(curses_menu, curses_menu_items);
968 968
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 06dd2e33581d..c2796b866f8f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1489,8 +1489,7 @@ void ConfigMainWindow::saveConfigAs(void)
1489 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); 1489 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
1490 if (s.isNull()) 1490 if (s.isNull())
1491 return; 1491 return;
1492 if (conf_write(QFile::encodeName(s))) 1492 saveConfig();
1493 QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
1494} 1493}
1495 1494
1496void ConfigMainWindow::searchConfig(void) 1495void ConfigMainWindow::searchConfig(void)
@@ -1643,7 +1642,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
1643 mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); 1642 mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
1644 switch (mb.exec()) { 1643 switch (mb.exec()) {
1645 case QMessageBox::Yes: 1644 case QMessageBox::Yes:
1646 conf_write(NULL); 1645 saveConfig();
1647 case QMessageBox::No: 1646 case QMessageBox::No:
1648 e->accept(); 1647 e->accept();
1649 break; 1648 break;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 3dbaec185cc4..b22f884f9022 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -294,11 +294,11 @@ void zconf_initscan(const char *name)
294 294
295 current_file = file_lookup(name); 295 current_file = file_lookup(name);
296 current_file->lineno = 1; 296 current_file->lineno = 1;
297 current_file->flags = FILE_BUSY;
298} 297}
299 298
300void zconf_nextfile(const char *name) 299void zconf_nextfile(const char *name)
301{ 300{
301 struct file *iter;
302 struct file *file = file_lookup(name); 302 struct file *file = file_lookup(name);
303 struct buffer *buf = malloc(sizeof(*buf)); 303 struct buffer *buf = malloc(sizeof(*buf));
304 memset(buf, 0, sizeof(*buf)); 304 memset(buf, 0, sizeof(*buf));
@@ -314,18 +314,25 @@ void zconf_nextfile(const char *name)
314 buf->parent = current_buf; 314 buf->parent = current_buf;
315 current_buf = buf; 315 current_buf = buf;
316 316
317 if (file->flags & FILE_BUSY) { 317 for (iter = current_file->parent; iter; iter = iter->parent ) {
318 printf("%s:%d: do not source '%s' from itself\n", 318 if (!strcmp(current_file->name,iter->name) ) {
319 zconf_curname(), zconf_lineno(), name); 319 printf("%s:%d: recursive inclusion detected. "
320 exit(1); 320 "Inclusion path:\n current file : '%s'\n",
321 } 321 zconf_curname(), zconf_lineno(),
322 if (file->flags & FILE_SCANNED) { 322 zconf_curname());
323 printf("%s:%d: file '%s' is already sourced from '%s'\n", 323 iter = current_file->parent;
324 zconf_curname(), zconf_lineno(), name, 324 while (iter && \
325 file->parent->name); 325 strcmp(iter->name,current_file->name)) {
326 exit(1); 326 printf(" included from: '%s:%d'\n",
327 iter->name, iter->lineno-1);
328 iter = iter->parent;
329 }
330 if (iter)
331 printf(" included from: '%s:%d'\n",
332 iter->name, iter->lineno+1);
333 exit(1);
334 }
327 } 335 }
328 file->flags |= FILE_BUSY;
329 file->lineno = 1; 336 file->lineno = 1;
330 file->parent = current_file; 337 file->parent = current_file;
331 current_file = file; 338 current_file = file;
@@ -335,8 +342,6 @@ static void zconf_endfile(void)
335{ 342{
336 struct buffer *parent; 343 struct buffer *parent;
337 344
338 current_file->flags |= FILE_SCANNED;
339 current_file->flags &= ~FILE_BUSY;
340 current_file = current_file->parent; 345 current_file = current_file->parent;
341 346
342 parent = current_buf->parent; 347 parent = current_buf->parent;