diff options
-rw-r--r-- | src/mds-kbdc/globals.c | 5 | ||||
-rw-r--r-- | src/mds-kbdc/globals.h | 5 | ||||
-rw-r--r-- | src/mds-kbdc/mds-kbdc.c | 17 | ||||
-rw-r--r-- | src/mds-kbdc/simplify-tree.c | 1 |
4 files changed, 27 insertions, 1 deletions
diff --git a/src/mds-kbdc/globals.c b/src/mds-kbdc/globals.c index bf2f91d..d5ae0d6 100644 --- a/src/mds-kbdc/globals.c +++ b/src/mds-kbdc/globals.c @@ -28,3 +28,8 @@ int argc; */ char** argv; +/** + * Whether ‘--force’ is used + */ +int argv_force = 0; + diff --git a/src/mds-kbdc/globals.h b/src/mds-kbdc/globals.h index 85a226d..068a304 100644 --- a/src/mds-kbdc/globals.h +++ b/src/mds-kbdc/globals.h @@ -29,6 +29,11 @@ extern int argc; */ extern char** argv; +/** + * Whether ‘--force’ is used + */ +extern int argv_force; + #endif diff --git a/src/mds-kbdc/mds-kbdc.c b/src/mds-kbdc/mds-kbdc.c index 6f4be18..65960dd 100644 --- a/src/mds-kbdc/mds-kbdc.c +++ b/src/mds-kbdc/mds-kbdc.c @@ -34,6 +34,21 @@ /** + * Parse command line arguments + */ +void parse_cmdline(void) +{ + int i; + for (i = 0; i < argc; i++) + { + char* arg = argv[i]; + if (strequals(arg, "--force")) + argv_force = 1; + } +} + + +/** * Compile a keyboard layout file * * @param argc_ The number of elements in `argv_` @@ -53,6 +68,8 @@ int main(int argc_, char** argv_) argc = argc_; argv = argv_; + parse_cmdline(); + mds_kbdc_parsed_initialise(&result); process (parse_to_tree(argv[1], &result)); process (simplify_tree(&result)); diff --git a/src/mds-kbdc/simplify-tree.c b/src/mds-kbdc/simplify-tree.c index 26a0084..170c9ef 100644 --- a/src/mds-kbdc/simplify-tree.c +++ b/src/mds-kbdc/simplify-tree.c @@ -692,7 +692,6 @@ static int simplify_unordered(mds_kbdc_tree_unordered_t* restrict tree) mds_kbdc_tree_t** here; int allow_long = 0; size_t argument_count; - int argv_force = 0; /* TODO globals.h */ /* Test for ‘(( ))’. */ if (tree->inner && (tree->inner->next == NULL) && (tree->inner->type == C(UNORDERED))) |