[remarks 4/4] make config / oldconfig: allow editing of remarks for config symbols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In conf_sym(), which is used for ask for all bool/tristate symbols,
print sym->remark (if one exists) befor prompting for the option and
analogous to help (triggered by an input beginning with '?'), when the
user enters a line starting with '<', allow the user to enter a remark
or update it.

This extension does not cover the configuration of string, integer or
choice values. I leave this open for follow-up submission in case there
is interest in the config symbol remarks in general and in really
supporting these also fully in make config, oldconfig and (possibly)
silbings.

Signed-off-by: Bernhard Kaindl <bernhard.kaindl@xxxxxxx>

PS:
make gconfig could also be considered for extension, but it does
apparently does not have a great deal of string editing UI yet,
so adding remarks to it would require finding a way to edit string
symbols in it first.
---
 scripts/kconfig/conf.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 9960d1c..dc60a1d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -158,8 +158,11 @@ static int conf_sym(struct menu *menu)
 	struct symbol *sym = menu->sym;
 	int type;
 	tristate oldval, newval;
+	char *p;
 
 	while (1) {
+		if (sym->remark)
+			printf("Remark: %s\n", sym->remark);
 		printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
 		if (sym->name)
 			printf("(%s) ", sym->name);
@@ -214,6 +217,8 @@ static int conf_sym(struct menu *menu)
 			break;
 		case '?':
 			goto help;
+		case '<':
+			goto remark;
 		default:
 			continue;
 		}
@@ -221,6 +226,20 @@ static int conf_sym(struct menu *menu)
 			return 0;
 help:
 		print_help(menu);
+		continue;
+remark:
+		if (sym->remark)
+			printf("Current Remark: %s\n", sym->remark);
+		printf("    New remark: ");
+		fgets(line, sizeof(line), stdin);
+
+		if ((p = strchr(line, '\n')))
+			*p = '\0';            /* no \n in remark */
+		if (line[0]) {
+			if (sym->remark)
+				free(sym->remark);
+			sym->remark = strdup(line);
+		}
 	}
 }
 
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux