summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2024-06-21 00:40:22 -0500
committer@syxhe <https://t.me/syxhe>2024-06-21 00:40:22 -0500
commit88e58b658ba08cedf9214c01200819da354a1796 (patch)
tree812a6853b79b83a32095177558e8c11e496df053
parent24a39d796e2803875ffe6f53314b1d851a79f35b (diff)
Clean up commented code
-rw-r--r--src/search.c59
1 files changed, 1 insertions, 58 deletions
diff --git a/src/search.c b/src/search.c
index eb39e08..3488136 100644
--- a/src/search.c
+++ b/src/search.c
@@ -100,66 +100,9 @@ struct nodelist* scanfolders(const char *STARTPATH, int (*cmp)(const struct dire
100} 100}
101 101
102int main(void) { 102int main(void) {
103 /*
104 struct dirent **nodes;
105 int n;
106
107 char *actualpath = NULL;
108 n = scandir("./", &nodes, foldersort, alphasort);
109 if(n >= 0) {
110 int cnt;
111 for(cnt = 0; cnt < n; ++cnt) {
112 actualpath = realpath(nodes[cnt]->d_name, actualpath);
113 puts(actualpath);
114 free(actualpath);
115 }
116
117 } else
118 perror("Couldn't open the directory");
119 //*/
120
121 /*
122 struct dirent **nodes = NULL;
123
124 struct nodelist *scanner = nodelist_init(NULL), *holder = NULL, *start = scanner;
125 scanner->fullpath = realpath("./", NULL);
126
127 for(; scanner != NULL; scanner = scanner->next) {
128 if(chdir(scanner->fullpath) < 0) {
129 error(0, errno, "Couldn't change to dir \"%s\". Skipping scan of that folder", scanner->fullpath);
130 continue;
131 }
132
133 int n = scandir(scanner->fullpath, &nodes, foldersort, alphasort);
134 if(n >= 0) {
135 for(int i = 0; i < n; i++) {
136 holder = nodelist_init(NULL);
137 holder->fullpath = realpath(nodes[i]->d_name, NULL);
138 nodelist_append(scanner, holder); // Yeah this is slow but idk rn
139 }
140 } else
141 error(-1, errno, "Couldn't open dir \"%s\"", scanner->fullpath);
142
143 }
144
145 for(struct nodelist *p = start; p != NULL; p = p->next) {
146 if(p->fullpath != NULL)
147 printf("%s\n", p->fullpath);
148 }
149
150 nodelist_delete(start);
151 //*/
152
153 struct nodelist *folders = NULL; 103 struct nodelist *folders = NULL;
154
155 folders = scanfolders("./", alphasort); 104 folders = scanfolders("./", alphasort);
156 105
157 /*
158 for(struct nodelist *p = folders; p != NULL; p = p->next)
159 printf("%s\n", p->fullpath);
160 */
161
162 //*
163 struct dirent **nodes; 106 struct dirent **nodes;
164 int n; 107 int n;
165 108