-3.5.0 28a33cbc24e4256c143dce96c7d93bf423229f92 Saber-toothed Squirrel
+3.6.0-rc1 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee Saber-toothed Squirrel
hg
"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 <SPACE BAR> and <B> for those\n"
-" who are familiar with less and lynx.\n"
+" keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n"
+" those who are familiar with less and lynx.\n"
"\n"
-"o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n"
+"o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n"
"\n"
"\n"
"Alternate Configuration Files\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 <SPACE BAR> for those\n"
-" who are familiar with less and lynx.\n"
+" keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n"
+" those who are familiar with less and lynx.\n"
"\n"
-"o Press <Enter>, <F1>, <F5>, <F7> or <Esc> to exit.\n"
+"o Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n"
"\n"
"\n"
"Alternate Configuration Files\n"
}
notimeout(stdscr, FALSE);
+#if NCURSES_REENTRANT
+ set_escdelay(1);
+#else
ESCDELAY = 1;
+#endif
/* set btns menu */
curses_menu = new_menu(curses_menu_items);
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:
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)
case 'e':
case 'X':
case 'x':
+ case 'q':
delwin(box);
delwin(dialog);
return 0;
break;
case 'B': /* Previous page */
case 'b':
+ case 'u':
case KEY_PPAGE:
if (begin_reached)
break;
break;
case KEY_NPAGE: /* Next page */
case ' ':
+ case 'd':
if (end_reached)
break;
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;
}
}
- while (fgets(line, sizeof(line), in)) {
+ while (compat_getline(&line, &line_asize, in) != -1) {
conf_lineno++;
sym = NULL;
if (line[0] == '#') {
cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
}
}
+ free(line);
fclose(in);
if (modules_sym)
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
#!/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 <<EOL
Set option to "string"
--set-val option value
Set option to value
+ --undefine|-u option Undefine option
--state|-s option Print state of option (n,y,m,undef)
--enable-after|-E beforeopt option
commands can be repeated multiple times
options:
- --file .config file to change (default .config)
+ --file config-file .config file to change (default .config)
+ --keep-case|-k Keep next symbols' case (dont' upper-case it)
config doesn't check the validity of the .config file. This is done at next
- make time.
+make time.
+
+By default, config will upper-case the given symbol. Use --keep-case to keep
+the case of all following symbols unchanged.
+
+config uses '@CONFIG_@' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
EOL
exit 1
}
ARG="${ARG/${CONFIG_}/}"
;;
esac
+ if [ "$MUNGE_CASE" = "yes" ] ; then
+ ARG="`echo $ARG | tr a-z A-Z`"
+ fi
}
set_var() {
fi
}
+undef_var() {
+ local name=$1
+
+ sed -ri "/^($name=|# $name is not set)/d" "$FN"
+}
+
if [ "$1" = "--file" ]; then
FN="$2"
if [ "$FN" = "" ] ; then
usage
fi
+MUNGE_CASE=yes
while [ "$1" != "" ] ; do
CMD="$1"
shift
case "$CMD" in
+ --keep-case|-k)
+ MUNGE_CASE=no
+ shift
+ continue
+ ;;
--refresh)
;;
--*-after)
set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
shift
;;
+ --undefine|-u)
+ undef_var "${CONFIG_}$ARG"
+ ;;
--state|-s)
if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
V="${V/#${CONFIG_}$ARG=/}"
V="${V/#\"/}"
V="${V/%\"/}"
- V="${V/\\\"/\"}"
+ V="${V//\\\"/\"}"
echo "${V}"
fi
fi
---- a/utils/tweak.in 2012-06-03 22:13:16.901125538 +0200
-+++ b/utils/tweak.in 2012-06-03 22:12:59.024523108 +0200
-@@ -1,6 +1,8 @@
+diff --git a/utils/tweak.in b/utils/tweak.in
+--- a/utils/tweak.in
++++ b/utils/tweak.in
+@@ -1,8 +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_}"
++# If no prefix forced, use the default @CONFIG_@
++CONFIG_="${CONFIG_-@CONFIG_@}"
+
usage() {
cat >&2 <<EOL
- Manipulate options in a .config file from the command line.
-@@ -40,11 +43,10 @@
- usage
- fi
- case "$ARG" in
-- CONFIG_*)
-- ARG="${ARG/CONFIG_/}"
-+ ${CONFIG_}*)
-+ ARG="${ARG/${CONFIG_}/}"
- ;;
- esac
-- ARG="`echo $ARG | tr a-z A-Z`"
- }
-
- set_var() {
-@@ -95,37 +97,37 @@
- esac
- case "$CMD" in
- --enable|-e)
-- set_var "CONFIG_$ARG" "CONFIG_$ARG=y"
-+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
- ;;
-
- --disable|-d)
-- set_var "CONFIG_$ARG" "# CONFIG_$ARG is not set"
-+ set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
- ;;
-
- --module|-m)
-- set_var "CONFIG_$ARG" "CONFIG_$ARG=m"
-+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
- ;;
-
- --set-str)
- # sed swallows one level of escaping, so we need double-escaping
-- set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\""
-+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
- shift
- ;;
-
- --set-val)
-- set_var "CONFIG_$ARG" "CONFIG_$ARG=$1"
-+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
- shift
- ;;
-
- --state|-s)
-- if grep -q "# CONFIG_$ARG is not set" $FN ; then
-+ if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
- echo n
- else
-- V="$(grep "^CONFIG_$ARG=" $FN)"
-+ V="$(grep "^${CONFIG_}$ARG=" $FN)"
- if [ $? != 0 ] ; then
- echo undef
- else
-- V="${V/#CONFIG_$ARG=/}"
-+ V="${V/#${CONFIG_}$ARG=/}"
- V="${V/#\"/}"
- V="${V/%\"/}"
- V="${V/\\\"/\"}"
-@@ -135,15 +137,15 @@
- ;;
-
- --enable-after|-E)
-- set_var "CONFIG_$B" "CONFIG_$B=y" "CONFIG_$A"
-+ set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
- ;;
-
- --disable-after|-D)
-- set_var "CONFIG_$B" "# CONFIG_$B is not set" "CONFIG_$A"
-+ set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
- ;;
-
- --module-after|-M)
-- set_var "CONFIG_$B" "CONFIG_$B=m" "CONFIG_$A"
-+ set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
- ;;
-
- # undocumented because it ignores --file (fixme)
+@@ -39,7 +39,7 @@
+ By default, config will upper-case the given symbol. Use --keep-case to keep
+ the case of all following symbols unchanged.
+
+-config uses 'CONFIG_' as the default symbol prefix. Set the environment
++config uses '@CONFIG_@' as the default symbol prefix. Set the environment
+ variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
+ EOL
+ exit 1