aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_lfiles.c
diff options
context:
space:
mode:
authorjozan <jozan@noemail.net>2020-11-05 23:41:43 +0000
committerjozan <jozan@noemail.net>2020-11-05 23:41:43 +0000
commita92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8 (patch)
treef26bc4aa0dac67ed1513a90817f021de5b291fff /src/c_lfiles.c
parentImprovement, skipping "." and ".." (diff)
downloadunixize-a92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8.tar.gz
unixize-a92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8.tar.bz2
unixize-a92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8.tar.xz
unixize-a92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8.tar.zst
unixize-a92830d0ad7eaf08e78bc1d2ad7ded8b06eaf1e8.zip
Duplicate done, trying to go recursive
FossilOrigin-Name: 7edc4e006cb1ee4e1baf5bc2f0d01524e5cd37ae3d2a046e9581d47475fa92aa
Diffstat (limited to 'src/c_lfiles.c')
-rw-r--r--src/c_lfiles.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/c_lfiles.c b/src/c_lfiles.c
index 53f8ad3..36976b6 100644
--- a/src/c_lfiles.c
+++ b/src/c_lfiles.c
@@ -122,10 +122,20 @@ c_lfiles_duplicate(struct lfiles_s** head)
struct lfiles_s* dup_link;
struct lfiles_s* origin;
- if (*head == NULL) {
+ dup_head = NULL;
+ if (head == NULL) {
return (NULL);
}
origin = *head;
+ while (origin != NULL) {
+ dup_link = c_lfiles_new(origin->filename, origin->filetype);
+ if (dup_link == NULL) {
+ u_dump_errno();
+ return (NULL);
+ }
+ origin = origin->next;
+ c_lfiles_add_back(&dup_head, dup_link);
+ }
return (dup_head);
}
@@ -136,15 +146,10 @@ c_lfiles_gather(void)
struct dirent* dp;
struct lfiles_s* head;
struct lfiles_s* link;
- char path[MAXPATHLEN];
head = NULL;
link = NULL;
- if (getcwd(path, MAXPATHLEN) == NULL) {
- u_dump_errno();
- return (NULL);
- }
- dirp = opendir(path);
+ dirp = opendir(".");
if (dirp == NULL) {
u_dump_errno();
return (NULL);