diff options
-rw-r--r-- | channel.c | 8 | ||||
-rw-r--r-- | channel.h | 2 | ||||
-rw-r--r-- | config.c | 1 | ||||
-rw-r--r-- | main.c | 22 |
4 files changed, 32 insertions, 1 deletions
@@ -42,6 +42,14 @@ struct channel_file_t *channel_file_add(struct channel_t *channel, const char *p return file; } +int channel_get_count() { + return channel_count; +} + +struct channel_t *channel_get(int index) { + return (index < channel_count ? &channels[index] : NULL); +} + void channel_free() { for(int i = 0; i < channel_count; i++) { free(channels[i].name); @@ -17,6 +17,8 @@ struct channel_t { void channel_init(); struct channel_t *channel_add(const char *name); struct channel_file_t *channel_file_add(struct channel_t *channel, const char *path, int rs_index); +int channel_get_count(); +struct channel_t *channel_get(int index); void channel_free(); #endif @@ -59,7 +59,6 @@ int cfg_init() { sprintf(sname, "channel #%d", i+1); name = sname; } - printf("Channel %s\n", name); struct channel_t *channel; if(!(channel = channel_add(name))) { return 0; @@ -17,6 +17,28 @@ int main(int argc, char **argv) { } /* 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(); |