1 #include "readsubdir.h"
5 #include "auto_split.h"
7 void readsubdir_init(rs,name,pause)
18 static char namepos[FMT_ULONG + 4 + READSUBDIR_NAMELEN];
20 int readsubdir_next(rs,id)
29 if (rs->pos >= auto_split) return 0;
30 if (str_len(rs->name) > READSUBDIR_NAMELEN) { rs->pos++; return -1; }
32 len += fmt_str(namepos + len,rs->name);
34 len += fmt_ulong(namepos + len,(unsigned long) rs->pos);
36 while (!(rs->dir = opendir(namepos))) rs->pause(namepos);
42 if (!d) { closedir(rs->dir); rs->dir = 0; return -1; }
44 if (str_equal(d->d_name,".")) return -1;
45 if (str_equal(d->d_name,"..")) return -1;
46 len = scan_ulong(d->d_name,id);
47 if (!len || d->d_name[len]) return -2;