Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/kconfig/nconf: add KEY_HOME / KEY_END for dialog_inputbox scripts/kconfig/nconf: fix editing long strings scripts/kconfig/nconf: dynamically alloc dialog_input_result scripts/kconfig/nconf: fix memmove's length arg scripts/kconfig/nconf: fix typo: unknow => unknown kconfig: fix set but not used variables kconfig: handle SIGINT in menuconfig kconfig: fix __enabled_ macros definition for invisible and un-selected symbols kconfig: factor code in menu_get_ext_help() kbuild: Fix help text not displayed in choice option. kconfig/nconf: nuke unreferenced `nohelp_text' kconfig/streamline_config.pl: merge local{mod,yes}config kconfig/streamline_config.pl: use options to determine operating mode kconfig/streamline_config.pl: directly access LSMOD from the environment
This commit is contained in:
commit
a84f6aa68e
@ -33,33 +33,9 @@ silentoldconfig: $(obj)/conf
|
|||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/generated
|
||||||
$< --$@ $(Kconfig)
|
$< --$@ $(Kconfig)
|
||||||
|
|
||||||
# if no path is given, then use src directory to find file
|
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
||||||
ifdef LSMOD
|
|
||||||
LSMOD_F := $(LSMOD)
|
|
||||||
ifeq ($(findstring /,$(LSMOD)),)
|
|
||||||
LSMOD_F := $(objtree)/$(LSMOD)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/generated
|
||||||
$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
|
$(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
|
||||||
$(Q)if [ -f .config ]; then \
|
|
||||||
cmp -s .tmp.config .config || \
|
|
||||||
(mv -f .config .config.old.1; \
|
|
||||||
mv -f .tmp.config .config; \
|
|
||||||
$(obj)/conf --silentoldconfig $(Kconfig); \
|
|
||||||
mv -f .config.old.1 .config.old) \
|
|
||||||
else \
|
|
||||||
mv -f .tmp.config .config; \
|
|
||||||
$(obj)/conf --silentoldconfig $(Kconfig); \
|
|
||||||
fi
|
|
||||||
$(Q)rm -f .tmp.config
|
|
||||||
|
|
||||||
localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
|
|
||||||
$(Q)mkdir -p include/generated
|
|
||||||
$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
|
|
||||||
$(Q)sed -i s/=m/=y/ .tmp.config
|
|
||||||
$(Q)if [ -f .config ]; then \
|
$(Q)if [ -f .config ]; then \
|
||||||
cmp -s .tmp.config .config || \
|
cmp -s .tmp.config .config || \
|
||||||
(mv -f .config .config.old.1; \
|
(mv -f .config .config.old.1; \
|
||||||
|
@ -503,17 +503,6 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
|
|||||||
fprintf(fp, "#define %s%s%s 1\n",
|
fprintf(fp, "#define %s%s%s 1\n",
|
||||||
CONFIG_, sym->name, suffix);
|
CONFIG_, sym->name, suffix);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Generate the __enabled_CONFIG_* and
|
|
||||||
* __enabled_CONFIG_*_MODULE macros for use by the
|
|
||||||
* IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
|
|
||||||
* generated even for booleans so that the IS_ENABLED() macro
|
|
||||||
* works.
|
|
||||||
*/
|
|
||||||
fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
|
|
||||||
sym->name, (*value == 'y'));
|
|
||||||
fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
|
|
||||||
sym->name, (*value == 'm'));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_HEX: {
|
case S_HEX: {
|
||||||
@ -564,6 +553,35 @@ static struct conf_printer header_printer_cb =
|
|||||||
.print_comment = header_print_comment,
|
.print_comment = header_print_comment,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for
|
||||||
|
* use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is
|
||||||
|
* generated even for booleans so that the IS_ENABLED() macro works.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (sym->type) {
|
||||||
|
case S_BOOLEAN:
|
||||||
|
case S_TRISTATE: {
|
||||||
|
fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n",
|
||||||
|
sym->name, (*value == 'y'));
|
||||||
|
fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n",
|
||||||
|
sym->name, (*value == 'm'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct conf_printer header__enabled_printer_cb =
|
||||||
|
{
|
||||||
|
.print_symbol = header_print__enabled_symbol,
|
||||||
|
.print_comment = header_print_comment,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tristate printer
|
* Tristate printer
|
||||||
*
|
*
|
||||||
@ -945,11 +963,16 @@ int conf_write_autoconf(void)
|
|||||||
conf_write_heading(out_h, &header_printer_cb, NULL);
|
conf_write_heading(out_h, &header_printer_cb, NULL);
|
||||||
|
|
||||||
for_all_symbols(i, sym) {
|
for_all_symbols(i, sym) {
|
||||||
sym_calc_value(sym);
|
if (!sym->name)
|
||||||
if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
|
continue;
|
||||||
|
|
||||||
|
sym_calc_value(sym);
|
||||||
|
|
||||||
|
conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL);
|
||||||
|
|
||||||
|
if (!(sym->flags & SYMBOL_WRITE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* write symbol to auto.conf, tristate and header files */
|
|
||||||
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
|
conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1);
|
||||||
|
|
||||||
conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
|
conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1);
|
||||||
|
@ -320,7 +320,6 @@ static void print_page(WINDOW * win, int height, int width)
|
|||||||
*/
|
*/
|
||||||
static void print_line(WINDOW * win, int row, int width)
|
static void print_line(WINDOW * win, int row, int width)
|
||||||
{
|
{
|
||||||
int y, x;
|
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
line = get_line();
|
line = get_line();
|
||||||
@ -329,10 +328,10 @@ static void print_line(WINDOW * win, int row, int width)
|
|||||||
waddch(win, ' ');
|
waddch(win, ' ');
|
||||||
waddnstr(win, line, MIN(strlen(line), width - 2));
|
waddnstr(win, line, MIN(strlen(line), width - 2));
|
||||||
|
|
||||||
getyx(win, y, x);
|
|
||||||
/* Clear 'residue' of previous line */
|
/* Clear 'residue' of previous line */
|
||||||
#if OLD_NCURSES
|
#if OLD_NCURSES
|
||||||
{
|
{
|
||||||
|
int x = getcurx(win);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < width - x; i++)
|
for (i = 0; i < width - x; i++)
|
||||||
waddch(win, ' ');
|
waddch(win, ' ');
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
@ -272,6 +273,7 @@ static struct menu *current_menu;
|
|||||||
static int child_count;
|
static int child_count;
|
||||||
static int single_menu_mode;
|
static int single_menu_mode;
|
||||||
static int show_all_options;
|
static int show_all_options;
|
||||||
|
static int saved_x, saved_y;
|
||||||
|
|
||||||
static void conf(struct menu *menu);
|
static void conf(struct menu *menu);
|
||||||
static void conf_choice(struct menu *menu);
|
static void conf_choice(struct menu *menu);
|
||||||
@ -792,9 +794,54 @@ static void conf_save(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int handle_exit(void)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
|
dialog_clear();
|
||||||
|
if (conf_get_changed())
|
||||||
|
res = dialog_yesno(NULL,
|
||||||
|
_("Do you wish to save your new configuration ?\n"
|
||||||
|
"<ESC><ESC> to continue."),
|
||||||
|
6, 60);
|
||||||
|
else
|
||||||
|
res = -1;
|
||||||
|
|
||||||
|
end_dialog(saved_x, saved_y);
|
||||||
|
|
||||||
|
switch (res) {
|
||||||
|
case 0:
|
||||||
|
if (conf_write(filename)) {
|
||||||
|
fprintf(stderr, _("\n\n"
|
||||||
|
"Error while writing of the configuration.\n"
|
||||||
|
"Your configuration changes were NOT saved."
|
||||||
|
"\n\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
case -1:
|
||||||
|
printf(_("\n\n"
|
||||||
|
"*** End of the configuration.\n"
|
||||||
|
"*** Execute 'make' to start the build or try 'make help'."
|
||||||
|
"\n\n"));
|
||||||
|
res = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, _("\n\n"
|
||||||
|
"Your configuration changes were NOT saved."
|
||||||
|
"\n\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sig_handler(int signo)
|
||||||
|
{
|
||||||
|
exit(handle_exit());
|
||||||
|
}
|
||||||
|
|
||||||
int main(int ac, char **av)
|
int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
int saved_x, saved_y;
|
|
||||||
char *mode;
|
char *mode;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -802,6 +849,8 @@ int main(int ac, char **av)
|
|||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
|
|
||||||
|
signal(SIGINT, sig_handler);
|
||||||
|
|
||||||
conf_parse(av[1]);
|
conf_parse(av[1]);
|
||||||
conf_read(NULL);
|
conf_read(NULL);
|
||||||
|
|
||||||
@ -823,40 +872,9 @@ int main(int ac, char **av)
|
|||||||
set_config_filename(conf_get_configname());
|
set_config_filename(conf_get_configname());
|
||||||
do {
|
do {
|
||||||
conf(&rootmenu);
|
conf(&rootmenu);
|
||||||
dialog_clear();
|
res = handle_exit();
|
||||||
if (conf_get_changed())
|
|
||||||
res = dialog_yesno(NULL,
|
|
||||||
_("Do you wish to save your "
|
|
||||||
"new configuration?\n"
|
|
||||||
"<ESC><ESC> to continue."),
|
|
||||||
6, 60);
|
|
||||||
else
|
|
||||||
res = -1;
|
|
||||||
} while (res == KEY_ESC);
|
} while (res == KEY_ESC);
|
||||||
end_dialog(saved_x, saved_y);
|
|
||||||
|
|
||||||
switch (res) {
|
return res;
|
||||||
case 0:
|
|
||||||
if (conf_write(filename)) {
|
|
||||||
fprintf(stderr, _("\n\n"
|
|
||||||
"Error while writing of the configuration.\n"
|
|
||||||
"Your configuration changes were NOT saved."
|
|
||||||
"\n\n"));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
case -1:
|
|
||||||
printf(_("\n\n"
|
|
||||||
"*** End of the configuration.\n"
|
|
||||||
"*** Execute 'make' to start the build or try 'make help'."
|
|
||||||
"\n\n"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, _("\n\n"
|
|
||||||
"Your configuration changes were NOT saved."
|
|
||||||
"\n\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
|
|
||||||
#include "lkc.h"
|
#include "lkc.h"
|
||||||
|
|
||||||
static const char nohelp_text[] = N_(
|
static const char nohelp_text[] = "There is no help available for this option.";
|
||||||
"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;
|
||||||
@ -595,16 +594,14 @@ struct gstr get_relations_str(struct symbol **sym_arr)
|
|||||||
void menu_get_ext_help(struct menu *menu, struct gstr *help)
|
void menu_get_ext_help(struct menu *menu, struct gstr *help)
|
||||||
{
|
{
|
||||||
struct symbol *sym = menu->sym;
|
struct symbol *sym = menu->sym;
|
||||||
|
const char *help_text = nohelp_text;
|
||||||
|
|
||||||
if (menu_has_help(menu)) {
|
if (menu_has_help(menu)) {
|
||||||
if (sym->name) {
|
if (sym->name)
|
||||||
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
|
str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
|
||||||
str_append(help, _(menu_get_help(menu)));
|
help_text = menu_get_help(menu);
|
||||||
str_append(help, "\n");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
str_append(help, nohelp_text);
|
|
||||||
}
|
}
|
||||||
|
str_printf(help, "%s\n", _(help_text));
|
||||||
if (sym)
|
if (sym)
|
||||||
get_symbol_str(help, sym);
|
get_symbol_str(help, sym);
|
||||||
}
|
}
|
||||||
|
@ -182,8 +182,6 @@ setmod_text[] = N_(
|
|||||||
"This feature depends on another which\n"
|
"This feature depends on another which\n"
|
||||||
"has been configured as a module.\n"
|
"has been configured as a module.\n"
|
||||||
"As a result, this feature will be built as a module."),
|
"As a result, this feature will be built as a module."),
|
||||||
nohelp_text[] = N_(
|
|
||||||
"There is no help available for this option.\n"),
|
|
||||||
load_config_text[] = N_(
|
load_config_text[] = N_(
|
||||||
"Enter the name of the configuration file you wish to load.\n"
|
"Enter the name of the configuration file you wish to load.\n"
|
||||||
"Accept the name shown to restore the configuration you\n"
|
"Accept the name shown to restore the configuration you\n"
|
||||||
@ -280,6 +278,9 @@ static int global_exit;
|
|||||||
/* the currently selected button */
|
/* the currently selected button */
|
||||||
const char *current_instructions = menu_instructions;
|
const char *current_instructions = menu_instructions;
|
||||||
|
|
||||||
|
static char *dialog_input_result;
|
||||||
|
static int dialog_input_result_len;
|
||||||
|
|
||||||
static void conf(struct menu *menu);
|
static void conf(struct menu *menu);
|
||||||
static void conf_choice(struct menu *menu);
|
static void conf_choice(struct menu *menu);
|
||||||
static void conf_string(struct menu *menu);
|
static void conf_string(struct menu *menu);
|
||||||
@ -695,7 +696,6 @@ static void search_conf(void)
|
|||||||
{
|
{
|
||||||
struct symbol **sym_arr;
|
struct symbol **sym_arr;
|
||||||
struct gstr res;
|
struct gstr res;
|
||||||
char dialog_input_result[100];
|
|
||||||
char *dialog_input;
|
char *dialog_input;
|
||||||
int dres;
|
int dres;
|
||||||
again:
|
again:
|
||||||
@ -703,7 +703,7 @@ again:
|
|||||||
_("Search Configuration Parameter"),
|
_("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_ "\")"),
|
||||||
"", dialog_input_result, 99);
|
"", &dialog_input_result, &dialog_input_result_len);
|
||||||
switch (dres) {
|
switch (dres) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
@ -1348,7 +1348,6 @@ static void conf_choice(struct menu *menu)
|
|||||||
static void conf_string(struct menu *menu)
|
static void conf_string(struct menu *menu)
|
||||||
{
|
{
|
||||||
const char *prompt = menu_get_prompt(menu);
|
const char *prompt = menu_get_prompt(menu);
|
||||||
char dialog_input_result[256];
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int res;
|
int res;
|
||||||
@ -1371,8 +1370,8 @@ static void conf_string(struct menu *menu)
|
|||||||
prompt ? _(prompt) : _("Main Menu"),
|
prompt ? _(prompt) : _("Main Menu"),
|
||||||
heading,
|
heading,
|
||||||
sym_get_string_value(menu->sym),
|
sym_get_string_value(menu->sym),
|
||||||
dialog_input_result,
|
&dialog_input_result,
|
||||||
sizeof(dialog_input_result));
|
&dialog_input_result_len);
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case 0:
|
case 0:
|
||||||
if (sym_set_string_value(menu->sym,
|
if (sym_set_string_value(menu->sym,
|
||||||
@ -1392,14 +1391,13 @@ static void conf_string(struct menu *menu)
|
|||||||
|
|
||||||
static void conf_load(void)
|
static void conf_load(void)
|
||||||
{
|
{
|
||||||
char dialog_input_result[256];
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int res;
|
int res;
|
||||||
res = dialog_inputbox(main_window,
|
res = dialog_inputbox(main_window,
|
||||||
NULL, load_config_text,
|
NULL, load_config_text,
|
||||||
filename,
|
filename,
|
||||||
dialog_input_result,
|
&dialog_input_result,
|
||||||
sizeof(dialog_input_result));
|
&dialog_input_result_len);
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!dialog_input_result[0])
|
if (!dialog_input_result[0])
|
||||||
@ -1424,14 +1422,13 @@ static void conf_load(void)
|
|||||||
|
|
||||||
static void conf_save(void)
|
static void conf_save(void)
|
||||||
{
|
{
|
||||||
char dialog_input_result[256];
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int res;
|
int res;
|
||||||
res = dialog_inputbox(main_window,
|
res = dialog_inputbox(main_window,
|
||||||
NULL, save_config_text,
|
NULL, save_config_text,
|
||||||
filename,
|
filename,
|
||||||
dialog_input_result,
|
&dialog_input_result,
|
||||||
sizeof(dialog_input_result));
|
&dialog_input_result_len);
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!dialog_input_result[0])
|
if (!dialog_input_result[0])
|
||||||
|
@ -356,7 +356,7 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
|
|||||||
|
|
||||||
int dialog_inputbox(WINDOW *main_window,
|
int dialog_inputbox(WINDOW *main_window,
|
||||||
const char *title, const char *prompt,
|
const char *title, const char *prompt,
|
||||||
const char *init, char *result, int result_len)
|
const char *init, char **resultp, int *result_len)
|
||||||
{
|
{
|
||||||
int prompt_lines = 0;
|
int prompt_lines = 0;
|
||||||
int prompt_width = 0;
|
int prompt_width = 0;
|
||||||
@ -367,7 +367,13 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
int i, x, y;
|
int i, x, y;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
int cursor_position = strlen(init);
|
int cursor_position = strlen(init);
|
||||||
|
int cursor_form_win;
|
||||||
|
char *result = *resultp;
|
||||||
|
|
||||||
|
if (strlen(init)+1 > *result_len) {
|
||||||
|
*result_len = strlen(init)+1;
|
||||||
|
*resultp = result = realloc(result, *result_len);
|
||||||
|
}
|
||||||
|
|
||||||
/* find the widest line of msg: */
|
/* find the widest line of msg: */
|
||||||
prompt_lines = get_line_no(prompt);
|
prompt_lines = get_line_no(prompt);
|
||||||
@ -384,7 +390,7 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
y = (LINES-(prompt_lines+4))/2;
|
y = (LINES-(prompt_lines+4))/2;
|
||||||
x = (COLS-(prompt_width+4))/2;
|
x = (COLS-(prompt_width+4))/2;
|
||||||
|
|
||||||
strncpy(result, init, result_len);
|
strncpy(result, init, *result_len);
|
||||||
|
|
||||||
/* create the windows */
|
/* create the windows */
|
||||||
win = newwin(prompt_lines+6, prompt_width+7, y, x);
|
win = newwin(prompt_lines+6, prompt_width+7, y, x);
|
||||||
@ -405,7 +411,9 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
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, " ");
|
||||||
mvwprintw(form_win, 0, 0, "%s", result);
|
cursor_form_win = min(cursor_position, prompt_width-1);
|
||||||
|
mvwprintw(form_win, 0, 0, "%s",
|
||||||
|
result + cursor_position-cursor_form_win);
|
||||||
|
|
||||||
/* create panels */
|
/* create panels */
|
||||||
panel = new_panel(win);
|
panel = new_panel(win);
|
||||||
@ -431,6 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
&result[cursor_position],
|
&result[cursor_position],
|
||||||
len-cursor_position+1);
|
len-cursor_position+1);
|
||||||
cursor_position--;
|
cursor_position--;
|
||||||
|
cursor_form_win--;
|
||||||
|
len--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_DC:
|
case KEY_DC:
|
||||||
@ -438,38 +448,63 @@ int dialog_inputbox(WINDOW *main_window,
|
|||||||
memmove(&result[cursor_position],
|
memmove(&result[cursor_position],
|
||||||
&result[cursor_position+1],
|
&result[cursor_position+1],
|
||||||
len-cursor_position+1);
|
len-cursor_position+1);
|
||||||
|
len--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
if (cursor_position < len &&
|
if (cursor_position < len) {
|
||||||
cursor_position < min(result_len, prompt_width))
|
|
||||||
cursor_position++;
|
cursor_position++;
|
||||||
|
cursor_form_win++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
case KEY_LEFT:
|
case KEY_LEFT:
|
||||||
if (cursor_position > 0)
|
if (cursor_position > 0) {
|
||||||
cursor_position--;
|
cursor_position--;
|
||||||
|
cursor_form_win--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case KEY_HOME:
|
||||||
|
cursor_position = 0;
|
||||||
|
cursor_form_win = 0;
|
||||||
|
break;
|
||||||
|
case KEY_END:
|
||||||
|
cursor_position = len;
|
||||||
|
cursor_form_win = min(cursor_position, prompt_width-1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((isgraph(res) || isspace(res)) &&
|
if ((isgraph(res) || isspace(res))) {
|
||||||
len-2 < result_len) {
|
/* one for new char, one for '\0' */
|
||||||
|
if (len+2 > *result_len) {
|
||||||
|
*result_len = len+2;
|
||||||
|
*resultp = result = realloc(result,
|
||||||
|
*result_len);
|
||||||
|
}
|
||||||
/* insert the char at the proper position */
|
/* insert the char at the proper position */
|
||||||
memmove(&result[cursor_position+1],
|
memmove(&result[cursor_position+1],
|
||||||
&result[cursor_position],
|
&result[cursor_position],
|
||||||
len+1);
|
len-cursor_position+1);
|
||||||
result[cursor_position] = res;
|
result[cursor_position] = res;
|
||||||
cursor_position++;
|
cursor_position++;
|
||||||
|
cursor_form_win++;
|
||||||
|
len++;
|
||||||
} else {
|
} else {
|
||||||
mvprintw(0, 0, "unknow key: %d\n", res);
|
mvprintw(0, 0, "unknown key: %d\n", res);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (cursor_form_win < 0)
|
||||||
|
cursor_form_win = 0;
|
||||||
|
else if (cursor_form_win > prompt_width-1)
|
||||||
|
cursor_form_win = prompt_width-1;
|
||||||
|
|
||||||
wmove(form_win, 0, 0);
|
wmove(form_win, 0, 0);
|
||||||
wclrtoeol(form_win);
|
wclrtoeol(form_win);
|
||||||
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
|
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
|
||||||
mvwprintw(form_win, 0, 0, "%s", result);
|
mvwprintw(form_win, 0, 0, "%s",
|
||||||
wmove(form_win, 0, cursor_position);
|
result + cursor_position-cursor_form_win);
|
||||||
|
wmove(form_win, 0, cursor_form_win);
|
||||||
touchwin(win);
|
touchwin(win);
|
||||||
refresh_all_windows(main_window);
|
refresh_all_windows(main_window);
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void fill_window(WINDOW *win, const char *text);
|
|||||||
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
|
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
|
||||||
int dialog_inputbox(WINDOW *main_window,
|
int dialog_inputbox(WINDOW *main_window,
|
||||||
const char *title, const char *prompt,
|
const char *title, const char *prompt,
|
||||||
const char *init, char *result, int result_len);
|
const char *init, char **resultp, int *result_len);
|
||||||
void refresh_all_windows(WINDOW *main_window);
|
void refresh_all_windows(WINDOW *main_window);
|
||||||
void show_scroll_win(WINDOW *main_window,
|
void show_scroll_win(WINDOW *main_window,
|
||||||
const char *title,
|
const char *title,
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
# make oldconfig
|
# make oldconfig
|
||||||
#
|
#
|
||||||
use strict;
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
my $config = ".config";
|
my $config = ".config";
|
||||||
|
|
||||||
@ -112,10 +113,17 @@ sub find_config {
|
|||||||
|
|
||||||
find_config;
|
find_config;
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
my $localmodconfig = 0;
|
||||||
|
my $localyesconfig = 0;
|
||||||
|
|
||||||
|
GetOptions("localmodconfig" => \$localmodconfig,
|
||||||
|
"localyesconfig" => \$localyesconfig);
|
||||||
|
|
||||||
# Get the build source and top level Kconfig file (passed in)
|
# Get the build source and top level Kconfig file (passed in)
|
||||||
my $ksource = $ARGV[0];
|
my $ksource = $ARGV[0];
|
||||||
my $kconfig = $ARGV[1];
|
my $kconfig = $ARGV[1];
|
||||||
my $lsmod_file = $ARGV[2];
|
my $lsmod_file = $ENV{'LSMOD'};
|
||||||
|
|
||||||
my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
|
my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
|
||||||
chomp @makefiles;
|
chomp @makefiles;
|
||||||
@ -296,8 +304,12 @@ my %modules;
|
|||||||
|
|
||||||
if (defined($lsmod_file)) {
|
if (defined($lsmod_file)) {
|
||||||
if ( ! -f $lsmod_file) {
|
if ( ! -f $lsmod_file) {
|
||||||
|
if ( -f $ENV{'objtree'}."/".$lsmod_file) {
|
||||||
|
$lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
|
||||||
|
} else {
|
||||||
die "$lsmod_file not found";
|
die "$lsmod_file not found";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( -x $lsmod_file) {
|
if ( -x $lsmod_file) {
|
||||||
# the file is executable, run it
|
# the file is executable, run it
|
||||||
open(LIN, "$lsmod_file|");
|
open(LIN, "$lsmod_file|");
|
||||||
@ -421,7 +433,11 @@ while(<CIN>) {
|
|||||||
|
|
||||||
if (/^(CONFIG.*)=(m|y)/) {
|
if (/^(CONFIG.*)=(m|y)/) {
|
||||||
if (defined($configs{$1})) {
|
if (defined($configs{$1})) {
|
||||||
|
if ($localyesconfig) {
|
||||||
|
$setconfigs{$1} = 'y';
|
||||||
|
} else {
|
||||||
$setconfigs{$1} = $2;
|
$setconfigs{$1} = $2;
|
||||||
|
}
|
||||||
} elsif ($2 eq "m") {
|
} elsif ($2 eq "m") {
|
||||||
print "# $1 is not set\n";
|
print "# $1 is not set\n";
|
||||||
next;
|
next;
|
||||||
|
Loading…
Reference in New Issue
Block a user