From b7e009a98698c4ed81b16cbc274a3b47793c1bab Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 3 Jun 2017 23:02:46 +0200 Subject: Config parser --- midimonster.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'midimonster.c') diff --git a/midimonster.c b/midimonster.c index 58166d6..5d7ec7f 100644 --- a/midimonster.c +++ b/midimonster.c @@ -1,4 +1,11 @@ #include "midimonster.h" +#include "config.h" +#include "backend.h" + +//temporary prototypes +int artnet_init(); +int midi_init(); +int osc_init(); int usage(char* fn){ fprintf(stderr, "MIDIMonster v0.1\n"); @@ -8,15 +15,32 @@ int usage(char* fn){ } int main(int argc, char** argv){ + int rv = EXIT_FAILURE; char* cfg_file = DEFAULT_CFG; if(argc > 1){ cfg_file = argv[1]; } //initialize backends + //TODO replace this with loading shared objects + if(artnet_init() /*|| midi_init() || osc_init()*/){ + fprintf(stderr, "Failed to initialize a backend\n"); + goto bail; + } + //read config + if(config_read(cfg_file)){ + fprintf(stderr, "Failed to read configuration file %s\n", cfg_file); + backends_stop(); + return usage(argv[0]); + } + //wait for events + + rv = EXIT_SUCCESS; +bail: //free all data + backends_stop(); - return EXIT_SUCCESS; + return rv; } -- cgit v1.2.3