aboutsummaryrefslogtreecommitdiff
path: root/src/engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine.c')
-rw-r--r--src/engine.c17
1 files changed, 17 insertions, 0 deletions
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);
}