summaryrefslogtreecommitdiff
path: root/src/readsubdir.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:52:39 +0200
commita6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch)
treeb88cc7a8457658d67e0321718556ac807f6bccf3 /src/readsubdir.c
parent00be7622c428f279872f84569f098ce16150f8a8 (diff)
format files
Diffstat (limited to 'src/readsubdir.c')
-rw-r--r--src/readsubdir.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/readsubdir.c b/src/readsubdir.c
index 754aa36..72b83e6 100644
--- a/src/readsubdir.c
+++ b/src/readsubdir.c
@@ -1,7 +1,9 @@
#include "readsubdir.h"
+
#include "fmt.h"
#include "scan.h"
#include "str.h"
+
#include "auto_split.h"
void readsubdir_init(readsubdir *rs, char *name, void (*pause)())
@@ -21,11 +23,14 @@ int readsubdir_next(readsubdir *rs, unsigned long *id)
if (!rs->dir) {
if (rs->pos >= auto_split) return 0;
- if (str_len(rs->name) > READSUBDIR_NAMELEN) { rs->pos++; return -1; }
+ if (str_len(rs->name) > READSUBDIR_NAMELEN) {
+ rs->pos++;
+ return -1;
+ }
len = 0;
- len += fmt_str(namepos + len,rs->name);
+ len += fmt_str(namepos + len, rs->name);
namepos[len++] = '/';
- len += fmt_ulong(namepos + len,(unsigned long) rs->pos);
+ len += fmt_ulong(namepos + len, (unsigned long)rs->pos);
namepos[len] = 0;
while (!(rs->dir = opendir(namepos))) rs->pause(namepos);
rs->pos++;
@@ -33,11 +38,15 @@ int readsubdir_next(readsubdir *rs, unsigned long *id)
}
d = readdir(rs->dir);
- if (!d) { closedir(rs->dir); rs->dir = 0; return -1; }
+ if (!d) {
+ closedir(rs->dir);
+ rs->dir = 0;
+ return -1;
+ }
- if (str_equal(d->d_name,".")) return -1;
- if (str_equal(d->d_name,"..")) return -1;
- len = scan_ulong(d->d_name,id);
+ if (str_equal(d->d_name, ".")) return -1;
+ if (str_equal(d->d_name, "..")) return -1;
+ len = scan_ulong(d->d_name, id);
if (!len || d->d_name[len]) return -2;
return 1;