#include <cmds.h>
#include <nonroot.h>
+#if WANT_DCACHE
+#include <dcache.h>
+#endif
+
#define lstat stat
extern struct conn *first_conn;
#endif
#if WANT_DCACHE
- /* populate the directory listing cache */
- {
- struct stat buf;
- struct dcache *d = alloc_new_dcache();
- if (d != NULL && stat(cwd, &buf) > -1) {
- d->use_count++;
- f->dir_cache = d;
- d->dir_data = f->file_data;
- d->dir_size = f->size;
- d->generated = buf.st_mtime;
-
- strcpy(d->dir_name, cwd);
- strncpy(d->pattern, ptr, 255);
- d->pattern[255] = 0;
- d->lo = *lo;
- }
- }
+ populate_dcache(f, cwd, ptr, lo);
#endif
#if HAVE_MMAP