aboutsummaryrefslogtreecommitdiff
path: root/src/msg.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-07-30 14:01:59 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-07-30 14:01:59 +0530
commitf57f335603a13c70168b1f46332a8827c32477b2 (patch)
tree06fe50976f3f72b3bcc063ec8f91156d6c08e003 /src/msg.c
parent9aba370924df4c471b8527f08d2c60cacb8989d9 (diff)
msg: get output directory from getopt
Diffstat (limited to 'src/msg.c')
-rw-r--r--src/msg.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/msg.c b/src/msg.c
index fc385b8..5e6092e 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -49,9 +49,13 @@ handle_file(const char *path)
char *dot = strrchr(inpath, '.');
if (dot && strcmp(dot, ".md") == 0) {
- asprintf(&outpath, "%s/%.*s.html", OUTPUT, (int) strlen(path) - 3, path);
+ asprintf(&outpath,
+ "%s/%.*s.html",
+ msg->output_directory,
+ (int) strlen(path) - 3,
+ path);
} else {
- asprintf(&outpath, "%s/%s", OUTPUT, path);
+ asprintf(&outpath, "%s/%s", msg->output_directory, path);
}
char *temp_outpath = strdup(outpath);
@@ -118,7 +122,7 @@ run(void)
base_template = template_create();
- int err = mkdir(OUTPUT, 0700);
+ int err = mkdir(msg->output_directory, 0700);
if (err != 0 && errno != EEXIST) {
perror("mkdir");
return EXIT_FAILURE;