diff options
Diffstat (limited to 'src/til.c')
-rw-r--r-- | src/til.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -4,6 +4,7 @@ #include <fcntl.h> #include <inttypes.h> #include <pthread.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> @@ -166,6 +167,35 @@ void til_get_modules(const til_module_t ***res_modules, size_t *res_n_modules) } +char * til_get_module_names(unsigned flags_excluded) +{ + const til_module_t **modules; + size_t n_modules; + char *buf; + size_t bufsz; + FILE *fp; + + /* FIXME TODO: more unportable memstream! */ + fp = open_memstream(&buf, &bufsz); + if (!fp) + return NULL; + + til_get_modules(&modules, &n_modules); + for (size_t i = 0, j = 0; i < n_modules; i++) { + const til_module_t *mod = modules[i]; + + if ((mod->flags & flags_excluded)) + continue; + + fprintf(fp, "%s%s", j ? "," : "", mod->name); + j++; + } + fclose(fp); + + return buf; +} + + static void module_render_fragment(til_module_context_t *context, til_stream_t *stream, til_threads_t *threads, unsigned ticks, til_fb_fragment_t **fragment_ptr) { const til_module_t *module; |