summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2024-12-26 21:42:53 -0600
committer@syxhe <https://t.me/syxhe>2024-12-26 21:42:53 -0600
commit03c5fce0220d3e5d02d320f925a3b9401a397729 (patch)
treedb27acac8fceee17cace9fa05ddd24fa6fe23cf9 /src/main.c
parentf7ded3958a7f3bea16e2c8be55f159f34a45ca61 (diff)
Put some notes down
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c23
1 files changed, 22 insertions, 1 deletions
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 @@
1#include "shared.h"
2
3#include <errno.h>
4#include <error.h>
1#include <stdio.h> 5#include <stdio.h>
2 6
7#include <fcntl.h>
8#include <dirent.h>
9
10int testfilter(const struct dirent *node) {
11 return 1;
12}
13
3int main() { 14int main() {
4 printf("We do a little trolling it's called we do a little trolling\nGod help us all\n"); 15 // 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)
16
17 int nnodes = -1;
18 struct dirent **nodes = NULL;
19 if((nnodes = scandir(".", &nodes, testfilter, alphasort)) < 0)
20 error(1, errno, "scandir broke");
21
22 for(int i = 0; i < nnodes; i++) {
23 printf("%s\n", nodes[i]->d_name);
24
25 }
5 26
6 return 0; 27 return 0;
7} \ No newline at end of file 28} \ No newline at end of file