aboutsummaryrefslogtreecommitdiffhomepage
path: root/midimonster.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-01-05 23:26:04 +0100
committercbdev <cb@cbcdn.com>2020-01-05 23:26:04 +0100
commite08b473d0eeb467ad358ba5314157753b4f37c18 (patch)
treed847784ab3a926054b586877e6d77865af574be1 /midimonster.c
parentf8ed6c26683c041ec61dac46d740b4b87df811ad (diff)
downloadmidimonster-e08b473d0eeb467ad358ba5314157753b4f37c18.tar.gz
midimonster-e08b473d0eeb467ad358ba5314157753b4f37c18.tar.bz2
midimonster-e08b473d0eeb467ad358ba5314157753b4f37c18.zip
Implement commandline config override (Fixes #26)
Diffstat (limited to 'midimonster.c')
-rw-r--r--midimonster.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/midimonster.c b/midimonster.c
index 2ec165b..583601e 100644
--- a/midimonster.c
+++ b/midimonster.c
@@ -274,9 +274,30 @@ static int args_parse(int argc, char** argv, char** cfg_file){
version();
return 1;
}
-
- //if nothing else matches, it's probably the configuration file
- *cfg_file = argv[u];
+ else if(!strcmp(argv[u], "-i")){
+ if(!argv[u + 1]){
+ fprintf(stderr, "Missing instance override specification\n");
+ return 1;
+ }
+ if(config_add_override(override_instance, argv[u + 1])){
+ return 1;
+ }
+ u++;
+ }
+ else if(!strcmp(argv[u], "-b")){
+ if(!argv[u + 1]){
+ fprintf(stderr, "Missing backend override specification\n");
+ return 1;
+ }
+ if(config_add_override(override_backend, argv[u + 1])){
+ return 1;
+ }
+ u++;
+ }
+ else{
+ //if nothing else matches, it's probably the configuration file
+ *cfg_file = argv[u];
+ }
}
return 0;
@@ -317,6 +338,7 @@ int main(int argc, char** argv){
map_free();
fds_free();
plugins_close();
+ config_free();
return usage(argv[0]);
}
@@ -403,6 +425,7 @@ bail:
fds_free();
event_free();
plugins_close();
+ config_free();
return rv;
}