From 03c5fce0220d3e5d02d320f925a3b9401a397729 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Thu, 26 Dec 2024 21:42:53 -0600 Subject: Put some notes down --- src/main.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index f07684d..bf110c2 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,28 @@ +#include "shared.h" + +#include +#include #include +#include +#include + +int testfilter(const struct dirent *node) { + return 1; +} + int main() { - printf("We do a little trolling it's called we do a little trolling\nGod help us all\n"); + // Alright, going to start simple. First: scanning for files. I want to do this quickly and in one motion. No reason to do things in O(n2) time if I can do it in O(n) + + int nnodes = -1; + struct dirent **nodes = NULL; + if((nnodes = scandir(".", &nodes, testfilter, alphasort)) < 0) + error(1, errno, "scandir broke"); + + for(int i = 0; i < nnodes; i++) { + printf("%s\n", nodes[i]->d_name); + + } return 0; } \ No newline at end of file -- cgit v1.2.3