aboutsummaryrefslogtreecommitdiff
path: root/scripts/write_config/write.c
blob: 9ba95ab134c3b71db69fcc73a8d64fd8d56a1f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <libintl.h>
#include <kconfig/lkc.h>
#include <macros.h>
#include <build_files.h>
#include "symlist.h"
#include "solution.h"

int verbose_level;
char *file, *folder;

int main(int argc, char **argv) {
    setlocale(LC_ALL, "");
    bindtextdomain(PACKAGE, LOCALEDIR);
    textdomain(PACKAGE);

    conf_parse("Kconfig");
    conf_read(".config");
    //conf_write(".config");
    /* verbose_level = 1;
       int i;
       for (i = 1; i < argc; i++) {
       if (!strcmp(argv[i], "-v"))
       verbose_level++;
       else if (file == NULL)
       file = argv[i];
       else if (folder == NULL)
       folder = argv[i];
       else {
       Eprintf("Unknown parameter: %s\n", argv[i]);
       exit(1);
       }
       }

       if (file == NULL) {
       Eprintf("No Kconfig input file specified\n");
       exit(2);
       }
       if (folder == NULL) {
       Eprintf("No output folder specified\n");
       exit(3);
       }

       char *rules_file, *symbol_map_file, *def_config_file, *solution_file;
       asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE);
       asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE);
       asprintf(&def_config_file, "%s/%s", folder, DEFAULT_DEF_CONFIG_FILE);
       asprintf(&solution_file, "%s/%s", folder, DEFAULT_SOLUTION_FILE);

       setlocale(LC_ALL, "");
       bindtextdomain(PACKAGE, LOCALEDIR);
       textdomain(PACKAGE);

       conf_parse(file);
       conf_read(def_config_file);

       FILE *f = fopen(symbol_map_file, "r");
       if (f == NULL) {
       Eprintf("Can't open file: %s\n", symbol_map_file);
       exit(1);
       }
       struct symlist *sl = symlist_read(f);
       fclose(f);

       f = fopen(solution_file, "r");
       if (f == NULL) {
       Eprintf("Can't open file: %s\n", solution_file);
       exit(2);
       }
       solution_set(sl, f);
       fclose(f);
     */

    return 0;
}