+ if (!rGroup->groupName || !*rGroup->groupName)
+ *gPrefix = '\0';
+ else
+ sprintf (gPrefix, "%s.", rGroup->groupName);
+
+ sprintf (resStr, "%srecordId", gPrefix);
+ rGroup->recordId = res_get (zh->res, resStr);
+ sprintf (resStr, "%sdatabasePath", gPrefix);
+ rGroup->databaseNamePath =
+ atoi (res_get_def (zh->res, resStr, "0"));
+
+ rGroup->databaseNamePath =
+ atoi (res_get_def (zh->res, resStr, "0"));
+
+ if (rGroup->followLinks == -1)
+ {
+ sprintf (resStr, "%sfollowLinks", gPrefix);
+ rGroup->followLinks =
+ atoi (res_get_def (zh->res, resStr, "1"));
+ }
+}
+
+void repositoryShow (ZebraHandle zh)
+
+{
+ struct recordGroup *rGroup = &zh->rGroup;
+ char src[1024];
+ int src_len;
+ struct dirs_entry *dst;
+ Dict dict;
+ struct dirs_info *di;
+
+ if (!(dict = dict_open (zh->reg->bfs, FMATCH_DICT, 50, 0, 0)))
+ {
+ logf (LOG_FATAL, "dict_open fail of %s", FMATCH_DICT);
+ return;
+ }
+
+ assert (rGroup->path);
+ strcpy (src, rGroup->path);
+ src_len = strlen (src);
+
+ if (src_len && src[src_len-1] != '/')
+ {
+ src[src_len] = '/';
+ src[++src_len] = '\0';
+ }
+
+ di = dirs_open (dict, src, rGroup->flagRw);
+
+ while ( (dst = dirs_read (di)) )
+ logf (LOG_LOG, "%s", dst->path);
+ dirs_free (&di);
+ dict_close (dict);
+}
+
+static void fileUpdate (ZebraHandle zh,
+ Dict dict, struct recordGroup *rGroup,
+ const char *path)
+{
+ struct dirs_info *di;
+ struct stat sbuf;
+ char src[1024];
+ char dst[1024];
+ int src_len;
+
+ assert (path);
+
+ if (zh->path_reg && !yaz_is_abspath(path))
+ {
+ strcpy (src, zh->path_reg);
+ strcat (src, "/");
+ }
+ else
+ *src = '\0';
+ strcat (src, path);
+ zebra_file_stat (src, &sbuf, rGroup->followLinks);
+
+ strcpy (src, path);
+ src_len = strlen (src);
+
+ if (S_ISREG(sbuf.st_mode))
+ {
+ struct dirs_entry *e_dst;
+ di = dirs_fopen (dict, src);
+
+ e_dst = dirs_read (di);
+ if (e_dst)
+ {
+ if (sbuf.st_mtime > e_dst->mtime)
+ if (fileExtract (zh, &e_dst->sysno, src, rGroup, 0))
+ dirs_add (di, src, e_dst->sysno, sbuf.st_mtime);
+ }
+ else
+ {
+ SYSNO sysno = 0;
+ if (fileExtract (zh, &sysno, src, rGroup, 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, rGroup->flagRw);
+ *dst = '\0';
+ fileUpdateR (zh, di, dirs_read (di), src, dst, rGroup, 0);
+ dirs_free (&di);
+ }
+ else