aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-25 16:36:42 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-25 16:36:42 +0100
commit4a8ce049471a53512de524260225ee15c63068e0 (patch)
tree25f462e4e7cddb7474d69a2f9008f8d7b7cb578b /FICS/utils.c
parentea9f71b612e70a68e902ed8b8497992b4f1099a0 (diff)
Reformatted t_mft()
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index aab8ce8..cf6f9b3 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -915,37 +915,42 @@ PRIVATE void t_cft(struct t_tree **t)
}
}
-/* make file tree for dir d */
-PRIVATE void t_mft(struct t_dirs *d)
+/*
+ * Make file tree for dir 'd'
+ */
+PRIVATE void
+t_mft(struct t_dirs *d)
{
- DIR *dirp;
+ DIR *dirp;
#ifdef USE_DIRENT
- struct dirent *dp;
+ struct dirent *dp;
#else
- struct direct *dp;
+ struct direct *dp;
#endif
- struct t_tree **t;
+ struct t_tree **t;
- if ((dirp = opendir(&(d->name))) == NULL) {
- fprintf(stderr, "FICS:mft() couldn't opendir.\n");
- } else {
- while ((dp = readdir(dirp))) {
- t = &d->files;
- if (dp->d_name[0] != '.') { /* skip anything starting with . */
- while (*t) {
- if (strcmp(dp->d_name, &(*t)->name) < 0) {
- t = &(*t)->left;
- } else {
- t = &(*t)->right;
- }
+ if ((dirp = opendir(&(d->name))) == NULL) {
+ fprintf(stderr, "FICS: %s: couldn't opendir\n", __func__);
+ return;
}
- *t = rmalloc(sizeof(struct t_tree) + strlen(dp->d_name));
- (*t)->right = (*t)->left = NULL;
- strcpy(&(*t)->name, dp->d_name);
- }
- }
- closedir(dirp);
- }
+ while ((dp = readdir(dirp))) {
+ t = &d->files;
+
+ if (dp->d_name[0] != '.') { // skip anything starting with '.'
+ while (*t) {
+ if (strcmp(dp->d_name, &(*t)->name) < 0)
+ t = &(*t)->left;
+ else
+ t = &(*t)->right;
+ }
+
+ *t = rmalloc(sizeof(struct t_tree) +
+ strlen(dp->d_name));
+ (*t)->right = (*t)->left = NULL;
+ strcpy(&(*t)->name, dp->d_name);
+ }
+ }
+ closedir(dirp);
}
/*