aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-04-12 12:09:04 +0200
committerKarel Kočí <cynerd@email.cz>2015-04-12 12:09:04 +0200
commited9db0936214f0cc30e33895a28eb5c18daffde0 (patch)
tree47955d2690a48c005d762cea672526d25ba27be2
parent2752b3c3802140163247348cba580e0320628941 (diff)
downloadlinux-conf-perf-ed9db0936214f0cc30e33895a28eb5c18daffde0.tar.gz
linux-conf-perf-ed9db0936214f0cc30e33895a28eb5c18daffde0.tar.bz2
linux-conf-perf-ed9db0936214f0cc30e33895a28eb5c18daffde0.zip
parse_kconfig: complete simple argument parser and formate parse.c
-rw-r--r--scripts/parse_kconfig/parser.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/scripts/parse_kconfig/parser.c b/scripts/parse_kconfig/parser.c
index 45e5c05..9157622 100644
--- a/scripts/parse_kconfig/parser.c
+++ b/scripts/parse_kconfig/parser.c
@@ -4,14 +4,13 @@
#include <locale.h>
#include <stdbool.h>
#include <libintl.h>
-#include <argp.h>
#include "kconfig/lkc.h"
#include "symlist.h"
#include "output.h"
#include "macros.h"
int verbose_level;
-char *file;
+char *file, *folder;
struct symlist *gsymlist;
int noname_num;
@@ -20,30 +19,35 @@ void build_symlist();
void cpy_dep();
int main(int argc, char **argv) {
- // TODO argp
verbose_level = 1;
int i;
- for (i = 0; i < argc; 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 (argc < 2) {
+ if (file == NULL) {
Eprintf("No input file specified\n");
- exit(1);
+ exit(2);
}
- if (argc < 3) {
+ if (folder == NULL) {
Eprintf("No output folder specified\n");
- exit(2);
+ exit(3);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- conf_parse(argv[1]);
+ conf_parse(file);
//sym_clear_all_valid();
gsymlist = symlist_create();
@@ -52,8 +56,8 @@ int main(int argc, char **argv) {
cpy_dep();
char *rules_file, *symbol_map_file;
- asprintf(&rules_file, "%s/%s", argv[2], DEFAULT_RULES_FILE);
- asprintf(&symbol_map_file, "%s/%s", argv[2], DEFAULT_SYMBOL_MAP_FILE);
+ asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE);
+ asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE);
fprint_rules(gsymlist, rules_file);
fprint_symbol_map(gsymlist, symbol_map_file);
return 0;
@@ -88,7 +92,8 @@ void cpy_dep() {
if (sym->dir_dep.expr != NULL) {
if (verbose_level > 3)
printf_original(gsymlist, sym->dir_dep.expr);
- el->be = kconfig_cnfexpr(gsymlist, false, sym->dir_dep.expr);
+ el->be =
+ kconfig_cnfexpr(gsymlist, false, sym->dir_dep.expr);
Iprintf("Direct:\n");
if (verbose_level > 2)
cnf_printf(el->be);
@@ -96,7 +101,8 @@ void cpy_dep() {
if (sym->rev_dep.expr != NULL) {
if (verbose_level > 3)
printf_original(gsymlist, sym->rev_dep.expr);
- el->re_be = kconfig_cnfexpr(gsymlist, true, sym->rev_dep.expr);
+ el->re_be =
+ kconfig_cnfexpr(gsymlist, true, sym->rev_dep.expr);
Iprintf("Revers:\n");
if (verbose_level > 2)
cnf_printf(el->re_be);