aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-07-27 18:43:11 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-07-27 18:43:11 +0530
commit3f87fe1fc65aafc7bb76fe6e34cd36f587794086 (patch)
tree35ca055515281367e2c6e3e3ce96dcfd3602d9cd
parent5e5171e3599449a569a369ca43009961032539de (diff)
engine: get list of files from key
-rw-r--r--compromyse.xyz/index.html4
-rw-r--r--src/engine.c17
2 files changed, 21 insertions, 0 deletions
diff --git a/compromyse.xyz/index.html b/compromyse.xyz/index.html
index a2421db..67c16e2 100644
--- a/compromyse.xyz/index.html
+++ b/compromyse.xyz/index.html
@@ -1,8 +1,12 @@
+<div class="p-16">
+</div>
+
{{ eachdo posts }}
KSFAISO
ASHIAUHSFI
HERE
{{ endeachdo }}
+
<div class="p-16">
<div class="flex flex-wrap gap-8">
diff --git a/src/engine.c b/src/engine.c
index d377bee..a494b71 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1,3 +1,4 @@
+#include "util.h"
#define _GNU_SOURCE
#include <copy.h>
@@ -81,6 +82,22 @@ handle_for(char **buffer, key_match_t *match, directive_t *directive)
printf("CONTENT: %s\n", operands->content);
#endif
+ char *path;
+ asprintf(&path, "%s/%s", msg->base_directory, operands->key);
+ list_t *files = enumfilesindir(path);
+ free(path);
+
+ if (files == NULL) {
+ printf("Could not find key %s\n", operands->key);
+ free(operands);
+ return;
+ }
+
+ for (size_t i = 0; i < files->size; i++) {
+ ptr_wrapper_t *wrapper = list_get(files, i);
+ printf("%s\n", (char *) wrapper->ptr);
+ }
+
exit(1);
free(operands);
}