From 6a5f266d85815c8614075017ba36a6f3be5a1b18 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Fri, 3 Aug 2012 23:49:37 +0200 Subject: [PATCH] Synchronise with 3.6-rc1 Signed-off-by: "Yann E. MORIN" --- .version | 2 +- frontends/mconf/mconf.c | 6 +-- frontends/nconf/nconf.c | 10 ++-- frontends/nconf/nconf.gui.c | 8 +-- libs/lxdialog/textbox.c | 3 ++ libs/parser/confdata.c | 61 ++++++++++++++++++++- scripts/ksync.log | 8 +++ utils/tweak.in | 35 ++++++++++-- utils/tweak.in.patch | 103 +++++++----------------------------- 9 files changed, 135 insertions(+), 101 deletions(-) diff --git a/.version b/.version index 1aaa947..4bc8c40 100644 --- a/.version +++ b/.version @@ -1,2 +1,2 @@ -3.5.0 28a33cbc24e4256c143dce96c7d93bf423229f92 Saber-toothed Squirrel +3.6.0-rc1 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee Saber-toothed Squirrel hg diff --git a/frontends/mconf/mconf.c b/frontends/mconf/mconf.c index f606738..f584a28 100644 --- a/frontends/mconf/mconf.c +++ b/frontends/mconf/mconf.c @@ -105,10 +105,10 @@ static const char mconf_readme[] = N_( "Text Box (Help Window)\n" "--------\n" "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" -" keys h,j,k,l function here as do and for those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , , and for \n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , or to exit.\n" +"o Press , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" diff --git a/frontends/nconf/nconf.c b/frontends/nconf/nconf.c index 8c0eb65..1704a85 100644 --- a/frontends/nconf/nconf.c +++ b/frontends/nconf/nconf.c @@ -83,10 +83,10 @@ static const char nconf_readme[] = N_( "Text Box (Help Window)\n" "--------\n" "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" -" keys h,j,k,l function here as do for those\n" -" who are familiar with less and lynx.\n" +" keys h,j,k,l function here as do , and for\n" +" those who are familiar with less and lynx.\n" "\n" -"o Press , , , or to exit.\n" +"o Press , , , , or to exit.\n" "\n" "\n" "Alternate Configuration Files\n" @@ -1503,7 +1503,11 @@ int main(int ac, char **av) } notimeout(stdscr, FALSE); +#if NCURSES_REENTRANT + set_escdelay(1); +#else ESCDELAY = 1; +#endif /* set btns menu */ curses_menu = new_menu(curses_menu_items); diff --git a/frontends/nconf/nconf.gui.c b/frontends/nconf/nconf.gui.c index 3b18dd8..379003c 100644 --- a/frontends/nconf/nconf.gui.c +++ b/frontends/nconf/nconf.gui.c @@ -604,9 +604,11 @@ void show_scroll_win(WINDOW *main_window, switch (res) { case KEY_NPAGE: case ' ': + case 'd': start_y += text_lines-2; break; case KEY_PPAGE: + case 'u': start_y -= text_lines+2; break; case KEY_HOME: @@ -632,10 +634,10 @@ void show_scroll_win(WINDOW *main_window, start_x++; break; } - if (res == 10 || res == 27 || res == 'q' - || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) { + if (res == 10 || res == 27 || res == 'q' || + res == KEY_F(F_HELP) || res == KEY_F(F_BACK) || + res == KEY_F(F_EXIT)) break; - } if (start_y < 0) start_y = 0; if (start_y >= total_lines-text_lines) diff --git a/libs/lxdialog/textbox.c b/libs/lxdialog/textbox.c index 154c2dd..4e5de60 100644 --- a/libs/lxdialog/textbox.c +++ b/libs/lxdialog/textbox.c @@ -129,6 +129,7 @@ do_resize: case 'e': case 'X': case 'x': + case 'q': delwin(box); delwin(dialog); return 0; @@ -190,6 +191,7 @@ do_resize: break; case 'B': /* Previous page */ case 'b': + case 'u': case KEY_PPAGE: if (begin_reached) break; @@ -214,6 +216,7 @@ do_resize: break; case KEY_NPAGE: /* Next page */ case ' ': + case 'd': if (end_reached) break; diff --git a/libs/parser/confdata.c b/libs/parser/confdata.c index 52577f0..13ddf11 100644 --- a/libs/parser/confdata.c +++ b/libs/parser/confdata.c @@ -182,10 +182,66 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) return 0; } +#define LINE_GROWTH 16 +static int add_byte(int c, char **lineptr, size_t slen, size_t *n) +{ + char *nline; + size_t new_size = slen + 1; + if (new_size > *n) { + new_size += LINE_GROWTH - 1; + new_size *= 2; + nline = realloc(*lineptr, new_size); + if (!nline) + return -1; + + *lineptr = nline; + *n = new_size; + } + + (*lineptr)[slen] = c; + + return 0; +} + +static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) +{ + char *line = *lineptr; + size_t slen = 0; + + for (;;) { + int c = getc(stream); + + switch (c) { + case '\n': + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + /* fall through */ + case EOF: + if (add_byte('\0', &line, slen, n) < 0) + goto e_out; + *lineptr = line; + if (slen == 0) + return -1; + return slen; + default: + if (add_byte(c, &line, slen, n) < 0) + goto e_out; + slen++; + } + } + +e_out: + line[slen-1] = '\0'; + *lineptr = line; + return -1; +} + int conf_read_simple(const char *name, int def) { FILE *in = NULL; - char line[1024]; + char *line = NULL; + size_t line_asize = 0; char *p, *p2; struct symbol *sym; int i, def_flags; @@ -247,7 +303,7 @@ load: } } - while (fgets(line, sizeof(line), in)) { + while (compat_getline(&line, &line_asize, in) != -1) { conf_lineno++; sym = NULL; if (line[0] == '#') { @@ -335,6 +391,7 @@ setsym: cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); } } + free(line); fclose(in); if (modules_sym) diff --git a/scripts/ksync.log b/scripts/ksync.log index 03dadd5..22d1e09 100644 --- a/scripts/ksync.log +++ b/scripts/ksync.log @@ -2,3 +2,11 @@ MCA: delete all remaining traces of microchannel bus support. scripts/config: properly report and set string options kbuild: all{no,yes,mod,def,rand}config only read files when instructed to. kconfig: Add error handling to KCONFIG_ALLCONFIG +nconf: add u, d command keys in scroll windows +menuconfig: add u, d, q command keys in text boxes +scripts/config: fix double-quotes un-escaping +kconfig: allow long lines in config file +kconfig/nconf: fix compile with ncurses reentrant API +scripts/config: add option to undef a symbol +scripts/config: allow alternate prefix to config option symbol +scripts/config: add option to not upper-case symbols diff --git a/utils/tweak.in b/utils/tweak.in index ef7a64a..743dc54 100644 --- a/utils/tweak.in +++ b/utils/tweak.in @@ -1,7 +1,8 @@ #!/bin/bash # Manipulate options in a .config file from the command line -CONFIG_="@CONFIG_@" +# If no prefix forced, use the default @CONFIG_@ +CONFIG_="${CONFIG_-@CONFIG_@}" usage() { cat >&2 <&2 <