Commit dfeaca8c authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] various kconfig updates

Various small kconfig updates to fix all the reported little problems and
the single menu mode for menuconfig by Petr Baudis <pasky@ucw.cz>.
parent 7f60c550
......@@ -252,7 +252,7 @@ ifdef include_config
# In this section, we need .config
-include ..config.cmd
-include .config.cmd
ifdef CONFIG_MODULES
export EXPORT_FLAGS := -DEXPORT_SYMTAB
......
Menuconfig gives the Linux kernel configuration a long needed face
lift. Featuring text based color menus and dialogs, it does not
require X Windows. With this utility you can easily select a kernel
option to modify without sifting through 100 other options.
require X Windows (however, you need ncurses in order to use it).
With this utility you can easily select a kernel option to modify
without sifting through 100 other options.
Overview
--------
......@@ -172,11 +173,17 @@ COMPATIBILITY ISSUE:
******** IMPORTANT, OPTIONAL ALTERNATE PERSONALITY AVAILABLE ********
******** ********
If you prefer to have all of the kernel options listed in a single
menu, rather than the default multimenu hierarchy, you may edit the
Menuconfig script and change the line "single_menu_mode=" to
"single_menu_mode=TRUE".
menu, rather than the default multimenu hierarchy, run the menuconfig
with MENUCONFIG_MODE environment variable set to single_menu. Example:
This mode is not recommended unless you have a fairly fast machine.
make menuconfig MENUCONFIG_MODE=single_menu
<Enter> will then unroll the appropriate category, or enfold it if it
is already unrolled.
Note that this mode can eventually be a little more CPU expensive
(especially with a larger number of unrolled categories) than the
default mode.
*********************************************************************
......
......@@ -115,6 +115,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
exit(1);
}
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
return;
case set_default:
......@@ -366,7 +367,7 @@ static int conf_choice(struct menu *menu)
for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
if (!cmenu->sym || !menu_is_visible(cmenu))
continue;
if (!strncmp(line, menu_get_prompt(cmenu), len)) {
if (!strncasecmp(line, menu_get_prompt(cmenu), len)) {
def_menu = cmenu;
break;
}
......
......@@ -117,7 +117,6 @@ int conf_read(const char *name)
*p++ = 0;
if (strncmp(p, "is not set", 10))
continue;
//printf("%s -> n\n", line + 9);
sym = sym_lookup(line + 9, 0);
switch (sym->type) {
case S_BOOLEAN:
......@@ -139,23 +138,29 @@ int conf_read(const char *name)
p2 = strchr(p, '\n');
if (p2)
*p2 = 0;
//printf("%s -> %s\n", line + 7, p);
sym = sym_find(line + 7);
if (!sym) {
fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 7);
break;
}
switch (sym->type) {
case S_BOOLEAN:
sym->def = symbol_yes.curr;
sym->flags &= ~SYMBOL_NEW;
break;
case S_TRISTATE:
if (p[0] == 'm')
sym->def = symbol_mod.curr;
else
sym->def = symbol_yes.curr;
sym->flags &= ~SYMBOL_NEW;
if (p[0] == 'm') {
S_TRI(sym->def) = mod;
sym->flags &= ~SYMBOL_NEW;
break;
}
case S_BOOLEAN:
if (p[0] == 'y') {
S_TRI(sym->def) = yes;
sym->flags &= ~SYMBOL_NEW;
break;
}
if (p[0] == 'n') {
S_TRI(sym->def) = no;
sym->flags &= ~SYMBOL_NEW;
break;
}
break;
case S_STRING:
if (*p++ != '"')
......
......@@ -169,7 +169,7 @@ struct menu {
//char *help;
struct file *file;
int lineno;
//void *data;
void *data;
};
#ifndef SWIG
......
This diff is collapsed.
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*
* Introduced single menu mode (show all sub-menus in one large tree).
* 2002-11-06 Petr Baudis <pasky@ucw.cz>
*/
#include <sys/ioctl.h>
......@@ -12,6 +15,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#define LKC_DIRECT_LINK
......@@ -80,10 +84,12 @@ static char buf[4096], *bufptr = buf;
static char input_buf[4096];
static char *args[1024], **argptr = args;
static int indent = 0;
static struct termios ios_org;
static int rows, cols;
static struct menu *current_menu;
static int child_count;
static int do_resize;
static int single_menu_mode;
static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
......@@ -274,10 +280,20 @@ static void build_conf(struct menu *menu)
case P_MENU:
child_count++;
cprint("m%p", menu);
if (menu->parent != &rootmenu)
cprint1(" %*c", indent + 1, ' ');
cprint1("%s --->", prompt);
if (single_menu_mode) {
cprint1("%s%*c%s",
menu->data ? "-->" : "++>",
indent + 1, ' ', prompt);
} else {
if (menu->parent != &rootmenu)
cprint1(" %*c", indent + 1, ' ');
cprint1("%s --->", prompt);
}
cprint_done();
if (single_menu_mode && menu->data)
goto conf_childs;
return;
default:
if (prompt) {
......@@ -392,6 +408,7 @@ static void conf(struct menu *menu)
char active_entry[40];
int stat, type, i;
unlink("lxdialog.scrltmp");
active_entry[0] = 0;
while (1) {
cprint_init();
......@@ -442,7 +459,10 @@ static void conf(struct menu *menu)
case 0:
switch (type) {
case 'm':
conf(submenu);
if (single_menu_mode)
submenu->data = (void *) !submenu->data;
else
conf(submenu);
break;
case 't':
if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
......@@ -484,6 +504,8 @@ static void conf(struct menu *menu)
case 6:
if (type == 't')
sym_toggle_tristate_value(sym);
else if (type == 'm')
conf(submenu);
break;
}
}
......@@ -518,11 +540,19 @@ static void show_helptext(const char *title, const char *text)
static void show_help(struct menu *menu)
{
const char *help;
char *helptext;
struct symbol *sym = menu->sym;
help = menu->sym->help;
help = sym->help;
if (!help)
help = nohelp_text;
show_helptext(menu_get_prompt(menu), help);
if (sym->name) {
helptext = malloc(strlen(sym->name) + strlen(help) + 16);
sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help);
show_helptext(menu_get_prompt(menu), helptext);
free(helptext);
} else
show_helptext(menu_get_prompt(menu), help);
}
static void show_readme(void)
......@@ -679,16 +709,35 @@ static void conf_save(void)
}
}
static void conf_cleanup(void)
{
tcsetattr(1, TCSAFLUSH, &ios_org);
unlink(".help.tmp");
unlink("lxdialog.scrltmp");
}
int main(int ac, char **av)
{
struct symbol *sym;
char *mode;
int stat;
conf_parse(av[1]);
conf_read(NULL);
sprintf(menu_backtitle, "Linux Kernel v%s.%s.%s%s Configuration",
getenv("VERSION"), getenv("PATCHLEVEL"),
getenv("SUBLEVEL"), getenv("EXTRAVERSION"));
sym = sym_lookup("KERNELRELEASE", 0);
sym_calc_value(sym);
sprintf(menu_backtitle, "Linux Kernel v%s Configuration",
sym_get_string_value(sym));
mode = getenv("MENUCONFIG_MODE");
if (mode) {
if (!strcasecmp(mode, "single_menu"))
single_menu_mode = 1;
}
tcgetattr(1, &ios_org);
atexit(conf_cleanup);
init_wsize();
conf(&rootmenu);
......
......@@ -290,7 +290,7 @@ int file_write_dep(const char *name)
FILE *out;
if (!name)
name = "..config.cmd";
name = ".config.cmd";
out = fopen("..config.tmp", "w");
if (!out)
return 1;
......
......@@ -17,6 +17,10 @@
#include <qheader.h>
#include <qfiledialog.h>
#include <qregexp.h>
#if QT_VERSION >= 300
#include <qsettings.h>
#endif
#include <stdlib.h>
#include "lkc.h"
......@@ -26,6 +30,9 @@
#include "images.c"
static QApplication *configApp;
#if QT_VERSION >= 300
static QSettings *configSettings;
#endif
/*
* update all the children of a menu entry
......@@ -613,6 +620,25 @@ ConfigView::ConfigView(void)
QMenuBar* menu;
QSplitter* split1;
QSplitter* split2;
bool ok;
int x, y, width, height;
QWidget *d = configApp->desktop();
#if QT_VERSION >= 300
width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
resize(width, height);
x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
if (ok)
y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
if (ok)
move(x, y);
#else
width = d->width() - 64;
height = d->height() - 64;
resize(width, height);
#endif
showDebug = false;
......@@ -1046,6 +1072,9 @@ int main(int ac, char** av)
#endif
configApp = new QApplication(ac, av);
#if QT_VERSION >= 300
configSettings = new QSettings;
#endif
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
case 'a':
......@@ -1063,11 +1092,20 @@ int main(int ac, char** av)
fixup_rootmenu(&rootmenu);
conf_read(NULL);
//zconfdump(stdout);
v = new ConfigView();
//zconfdump(stdout);
v->show();
configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
configApp->exec();
#if QT_VERSION >= 300
configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
delete configSettings;
#endif
return 0;
}
%option backup nostdinit noyywrap full ecs
%option backup nostdinit noyywrap never-interactive full ecs
%option 8bit backup nodefault perf-report perf-report
%x COMMAND HELP STRING PARAM
%{
......@@ -83,8 +83,6 @@ n [A-Za-z0-9_]
. {
unput(yytext[0]);
//printf("new config: ");
//symbol_end(NULL);
BEGIN(COMMAND);
}
......@@ -144,31 +142,43 @@ n [A-Za-z0-9_]
return T_WORD;
}
.
<<EOF>> {
BEGIN(INITIAL);
}
}
<STRING>{
[^'"\n\\]+ {
[^'"\\\n]+/\n {
append_string(yytext, yyleng);
zconflval.string = text;
return T_STRING;
}
[^'"\\\n]+ {
append_string(yytext, yyleng);
}
\\.?/\n {
append_string(yytext+1, yyleng);
zconflval.string = text;
return T_STRING;
}
\\.? {
append_string(yytext+1, yyleng);
}
\'|\" {
if (str == yytext[0]) {
BEGIN(PARAM);
zconflval.string = text;
//printf("s:%s\n", text);
return T_STRING;
} else
append_string(yytext, 1);
}
\\[ \t]*\n append_string(yytext+yyleng-1, 1); current_file->lineno++;
\\[ \t]* append_string(yytext+1, yyleng-1);
\\. append_string(yytext+1, 1);
\n {
//printf(":%d: open string!\n", current_file->lineno+1);
exit(0);
printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
BEGIN(INITIAL);
return T_EOL;
}
<<EOF>> {
//printf(":%d: open string!\n", current_file->lineno+1);
exit(0);
BEGIN(INITIAL);
}
}
......@@ -221,6 +231,7 @@ n [A-Za-z0-9_]
zconf_endfile();
return T_EOF;
}
fclose(yyin);
yyterminate();
}
......@@ -245,7 +256,6 @@ void zconf_initscan(const char *name)
printf("can't find file %s\n", name);
exit(1);
}
//fprintf(stderr, "zconf_initscan: %s\n", name);
current_buf = malloc(sizeof(*current_buf));
memset(current_buf, 0, sizeof(*current_buf));
......@@ -271,8 +281,6 @@ void zconf_nextfile(const char *name)
buf->parent = current_buf;
current_buf = buf;
//fprintf(stderr, "zconf_nextfile: %s\n", name);
if (file->flags & FILE_BUSY) {
printf("recursive scan (%s)?\n", name);
exit(1);
......@@ -297,6 +305,7 @@ static struct buffer *zconf_endfile(void)
parent = current_buf->parent;
if (parent) {
fclose(yyin);
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(parent->state);
}
......
This diff is collapsed.
/* A Bison parser, made from zconf.y, by GNU bison 1.75. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
#ifndef BISON_ZCONF_TAB_H
# define BISON_ZCONF_TAB_H
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
T_MAINMENU = 258,
T_MENU = 259,
T_ENDMENU = 260,
T_SOURCE = 261,
T_CHOICE = 262,
T_ENDCHOICE = 263,
T_COMMENT = 264,
T_CONFIG = 265,
T_HELP = 266,
T_HELPTEXT = 267,
T_IF = 268,
T_ENDIF = 269,
T_DEPENDS = 270,
T_REQUIRES = 271,
T_OPTIONAL = 272,
T_PROMPT = 273,
T_DEFAULT = 274,
T_TRISTATE = 275,
T_BOOLEAN = 276,
T_INT = 277,
T_HEX = 278,
T_WORD = 279,
T_STRING = 280,
T_UNEQUAL = 281,
T_EOF = 282,
T_EOL = 283,
T_CLOSE_PAREN = 284,
T_OPEN_PAREN = 285,
T_ON = 286,
T_OR = 287,
T_AND = 288,
T_EQUAL = 289,
T_NOT = 290
};
#endif
#define T_MAINMENU 258
#define T_MENU 259
#define T_ENDMENU 260
#define T_SOURCE 261
#define T_CHOICE 262
#define T_ENDCHOICE 263
#define T_COMMENT 264
#define T_CONFIG 265
#define T_HELP 266
#define T_HELPTEXT 267
#define T_IF 268
#define T_ENDIF 269
#define T_DEPENDS 270
#define T_REQUIRES 271
#define T_OPTIONAL 272
#define T_PROMPT 273
#define T_DEFAULT 274
#define T_TRISTATE 275
#define T_BOOLEAN 276
#define T_INT 277
#define T_HEX 278
#define T_WORD 279
#define T_STRING 280
#define T_UNEQUAL 281
#define T_EOF 282
#define T_EOL 283
#define T_CLOSE_PAREN 284
#define T_OPEN_PAREN 285
#define T_ON 286
#define T_OR 287
#define T_AND 288
#define T_EQUAL 289
#define T_NOT 290
#ifndef YYSTYPE
typedef union
{
#line 33 "zconf.y"
typedef union {
int token;
char *string;
struct symbol *symbol;
struct expr *expr;
struct menu *menu;
} yystype;
/* Line 1281 of /usr/share/bison/yacc.c. */
#line 118 "zconf.tab.h"
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
# define T_MAINMENU 257
# define T_MENU 258
# define T_ENDMENU 259
# define T_SOURCE 260
# define T_CHOICE 261
# define T_ENDCHOICE 262
# define T_COMMENT 263
# define T_CONFIG 264
# define T_HELP 265
# define T_HELPTEXT 266
# define T_IF 267
# define T_ENDIF 268
# define T_DEPENDS 269
# define T_REQUIRES 270
# define T_OPTIONAL 271
# define T_PROMPT 272
# define T_DEFAULT 273
# define T_TRISTATE 274
# define T_BOOLEAN 275
# define T_INT 276
# define T_HEX 277
# define T_WORD 278
# define T_STRING 279
# define T_UNEQUAL 280
# define T_EOF 281
# define T_EOL 282
# define T_CLOSE_PAREN 283
# define T_OPEN_PAREN 284
# define T_ON 285
# define T_OR 286
# define T_AND 287
# define T_EQUAL 288
# define T_NOT 289
extern YYSTYPE zconflval;
#endif /* not BISON_ZCONF_TAB_H */
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