#include #include "config.h" #include "regexset.h" #include "channel.h" int main(int argc, char **argv) { /* Regex sets must be initialized before config. */ rs_init(); channel_init(); if(!cfg_init()) { /* Free any registered regex sets and channels when config fails. Config will fail if a regex set fails to compile all parts. */ rs_free(); channel_free(); return 1; } /* Parsing stuff goes here. */ for(int chan_i = 0; chan_i < channel_get_count(); chan_i++) { struct channel_t *channel = channel_get(chan_i); printf("Channel %s\n", channel->name); struct channel_file_t *file = channel->files; while(file) { struct regexset_t *rs = file->rs; FILE *f = fopen(file->path, "r"); if(!f) { fprintf(stderr, "\tFailed to open %s\n", file->path); file = file->next; continue; } else printf("\tParsing %s\n", file->path); char line[0x2ff]; while(fgets(line, 0x2ff, f)) { // TODO: Magic. } file = file->next; } } cfg_free(); channel_free(); rs_free(); return 0; }