#include "shared.h" #include #include #include #include #include int testfilter(const struct dirent *node) { return 1; } int main() { // 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; }