+ strcpy (src, path);
+ src_len = strlen (src);
+
+ if (ret == -1)
+ {
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src);
+ }
+ else if (S_ISREG(sbuf.st_mode))
+ {
+ struct dirs_entry *e_dst;
+ di = dirs_fopen (dict, src, zh->m_flag_rw);
+
+ e_dst = dirs_read (di);
+ if (e_dst)
+ {
+ if (sbuf.st_mtime > e_dst->mtime)
+ if (fileExtract (zh, &e_dst->sysno, src, 0))
+ dirs_add (di, src, e_dst->sysno, sbuf.st_mtime);
+ }
+ else
+ {
+ SYSNO sysno = 0;
+ if (fileExtract (zh, &sysno, src, 0))
+ dirs_add (di, src, sysno, sbuf.st_mtime);
+ }
+ dirs_free (&di);
+ }
+ else if (S_ISDIR(sbuf.st_mode))
+ {
+ if (src_len && src[src_len-1] != '/')
+ {
+ src[src_len] = '/';
+ src[++src_len] = '\0';
+ }
+ di = dirs_open (dict, src, zh->m_flag_rw);
+ *dst = '\0';
+ fileUpdateR (zh, di, dirs_read (di), src, dst, 0);
+ dirs_free (&di);
+ }
+ else
+ {
+ yaz_log (YLOG_WARN, "Skipping path %s", src);
+ }
+}
+
+static void repositoryExtract (ZebraHandle zh,
+ int deleteFlag, const char *path)
+{
+ struct stat sbuf;
+ char src[1024];
+ int ret;
+
+ assert (path);
+
+ if (zh->path_reg && !yaz_is_abspath(path))
+ {
+ strcpy (src, zh->path_reg);
+ strcat (src, "/");
+ }
+ else
+ *src = '\0';
+ strcat (src, path);
+ ret = zebra_file_stat (src, &sbuf, zh->m_follow_links);
+
+ strcpy (src, path);
+
+ if (ret == -1)
+ yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot access path %s", src);
+ else if (S_ISREG(sbuf.st_mode))
+ fileExtract (zh, NULL, src, deleteFlag);
+ else if (S_ISDIR(sbuf.st_mode))
+ repositoryExtractR (zh, deleteFlag, src, 0);
+ else
+ yaz_log (YLOG_WARN, "Skipping path %s", src);
+}
+
+static void repositoryExtractG (ZebraHandle zh, const char *path,
+ int deleteFlag)
+{
+ if (!strcmp(path, "") || !strcmp(path, "-"))
+ {
+ char src[1024];
+
+ while (scanf ("%1020s", src) == 1)
+ repositoryExtract (zh, deleteFlag, src);
+ }
+ else
+ repositoryExtract (zh, deleteFlag, path);
+}
+
+#if 0
+static int dump_file_dict_func(char *name, const char *info, int pos,
+ void *client)
+{
+ yaz_log(YLOG_LOG, "%s", name);
+ return 0;