aboutsummaryrefslogtreecommitdiff
path: root/scripts/write_config/write_config.c
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-07-24 17:19:22 +0200
committerKarel Kočí <cynerd@email.cz>2015-07-24 17:19:22 +0200
commit4df04029a616013e1d795102eab790c628d6dac1 (patch)
treedc6c194934e371cae82d3b511673dec4b1f1f612 /scripts/write_config/write_config.c
parent2088e7c783964176076f83d8df04dac5adc9781d (diff)
downloadlinux-conf-perf-4df04029a616013e1d795102eab790c628d6dac1.tar.gz
linux-conf-perf-4df04029a616013e1d795102eab790c628d6dac1.tar.bz2
linux-conf-perf-4df04029a616013e1d795102eab790c628d6dac1.zip
Rewrite write_config
Write config don't need to load jobfiles any more. We only have to load file passed via argument and save using kconfig code. Configuration checking is disabled. It needs more editing.
Diffstat (limited to 'scripts/write_config/write_config.c')
-rw-r--r--scripts/write_config/write_config.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/write_config/write_config.c b/scripts/write_config/write_config.c
new file mode 100644
index 0000000..1f061d1
--- /dev/null
+++ b/scripts/write_config/write_config.c
@@ -0,0 +1,65 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <libintl.h>
+#include <string.h>
+
+#include <kconfig/lkc.h>
+#include <macros.h>
+#include <build_files.h>
+#include "solution.h"
+
+const char defkconfig_file[] = "Kconfig";
+const char defoutput_config[] = ".config";
+
+int verbose_level;
+char *kconfig_file;
+char *input_config;
+
+void print_help();
+
+int exit_status;
+
+int main(int argc, char **argv) {
+ exit_status = 0;
+ verbose_level = 1;
+ kconfig_file = (char*)defkconfig_file;
+ int i;
+ for (i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
+ print_help();
+ exit(0);
+ } else if (!strcmp(argv[i], "-v")) {
+ verbose_level++;
+ } else if (input_config == NULL) {
+ input_config = argv[i];
+ } else {
+ Eprintf("Unknown parameter: %s\n", argv[i]);
+ exit(-1);
+ }
+ }
+
+ if (input_config == NULL) {
+ Eprintf("No input config specified.");
+ print_help();
+ exit(2);
+ }
+
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+ conf_parse(kconfig_file);
+ conf_read(input_config);
+
+ // TODO configuration check disabled. It is not compatible after changes.
+
+ conf_write(defoutput_config);
+
+ return exit_status;
+}
+
+void print_help() {
+ printf("Usage: write_config [-v] [-h] Input\n");
+ printf(" This applies configuration to Linux.");
+}