- after = p->no_max = 400;
- p->entries = xmalloc (sizeof(*p->entries) * (p->no_max));
- logf (LOG_DEBUG, "dirs_open first scan");
- dict_scan (p->dict, p->nextpath, &before, &after, p, dirs_client_proc);
+ after = p->no_max = 100;
+ p->entries = (struct dirs_entry *)
+ xmalloc(sizeof(*p->entries) * (p->no_max));
+ yaz_log(YLOG_DEBUG, "dirs_open first scan");
+ dict_scan(p->dict, p->nextpath, &before, &after, p, dirs_client_proc);
+ return p;
+}
+
+struct dirs_info *dirs_fopen(Dict dict, const char *path, int rw)
+{
+ struct dirs_info *p;
+ struct dirs_entry *entry;
+ char *info;
+
+ p = (struct dirs_info *) xmalloc(sizeof(*p));
+ p->dict = dict;
+ p->rw = rw;
+ *p->prefix = '\0';
+ p->entries = (struct dirs_entry *) xmalloc(sizeof(*p->entries));
+ p->no_read = 0;
+ p->no_cur = 0;
+ p->no_max = 2;
+
+ entry = p->entries;
+ info = dict_lookup(dict, path);
+ if (info && info[0] == sizeof(entry->sysno)+sizeof(entry->mtime))
+ {
+ strcpy(entry->path, path);
+ entry->kind = dirs_file;
+ memcpy(&entry->sysno, info+1, sizeof(entry->sysno));
+ memcpy(&entry->mtime, info+1+sizeof(entry->sysno),
+ sizeof(entry->mtime));
+ p->no_cur++;
+ }