diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-30 20:18:13 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2025-07-30 20:18:13 +0530 |
commit | 8e6dad06fe4c0bb83f44ff016c3814b9c89f385b (patch) | |
tree | ddd4c6339f6c73c88f8c03c05e29c9774b09eeae | |
parent | 48016ebbe55051ea4745c57cbc937d2a66c22ef9 (diff) |
template: template_create() must accept template name
-rw-r--r-- | include/template.h | 2 | ||||
-rw-r--r-- | src/msg.c | 2 | ||||
-rw-r--r-- | src/template.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/include/template.h b/include/template.h index c489e45..e70b460 100644 --- a/include/template.h +++ b/include/template.h @@ -27,7 +27,7 @@ typedef struct { list_t *components; } template_t; -template_t *template_create(void); +template_t *template_create(char *template_name); void template_delete(template_t *template); void template_write(template_t *template, list_t *content_headers, @@ -128,7 +128,7 @@ run(void) if (config == NULL) return EXIT_FAILURE; - base_template = template_create(); + base_template = template_create(BASE_TEMPLATE); int err = mkdir(msg->output_directory, 0700); if (err != 0 && errno != EEXIST) { diff --git a/src/template.c b/src/template.c index 73b21e4..6773986 100644 --- a/src/template.c +++ b/src/template.c @@ -32,12 +32,12 @@ extern msg_t *msg; template_t * -template_create(void) +template_create(char *template_name) { template_t *template = malloc(sizeof(template_t)); char *path; - asprintf(&path, "%s/%s/%s", msg->base_directory, TEMPLATES, BASE_TEMPLATE); + asprintf(&path, "%s/%s/%s", msg->base_directory, TEMPLATES, template_name); FILE *base = fopen(path, "r"); free(path); |