--- 1.3.2 2002/MM/DD
+New config setting, followLinks, that controls whether update or files
+should follow symbolic. Set it to 1 (for enable) or 0 (to disable).
+By default symbolic links are followed.
+
Fix MARC transfer . MARC fields had wrong data for multiple fields.
XML record reader moved from YAZ to Zebra, to make YAZ less
-/* $Id: dir.c,v 1.23 2002-08-02 19:26:55 adam Exp $
+/* $Id: dir.c,v 1.24 2002-09-03 11:44:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <unistd.h>
#endif
#include <direntz.h>
-#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include "index.h"
-struct dir_entry *dir_open (const char *rep, const char *base)
+
+int zebra_file_stat (const char *file_name, struct stat *buf,
+ int follow_links)
+{
+ if (follow_links)
+ return stat(file_name, buf);
+ return lstat(file_name, buf);
+}
+
+struct dir_entry *dir_open (const char *rep, const char *base,
+ int follow_links)
{
DIR *dir;
char path[1024];
strcpy (full_rep, base);
strcat (full_rep, "/");
strcat (full_rep, path);
- stat (full_rep, &finfo);
+ zebra_file_stat (full_rep, &finfo, follow_links);
}
else
- stat (path, &finfo);
+ zebra_file_stat (path, &finfo, follow_links);
switch (finfo.st_mode & S_IFMT)
{
case S_IFREG:
-/* $Id: index.h,v 1.86 2002-08-28 19:52:29 adam Exp $
+/* $Id: index.h,v 1.87 2002-09-03 11:44:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#if HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
+#include <sys/stat.h>
#include <dict.h>
#include <isams.h>
void dirs_del (struct dirs_info *p, const char *src);
void dirs_free (struct dirs_info **pp);
-struct dir_entry *dir_open (const char *rep, const char *base);
+struct dir_entry *dir_open (const char *rep, const char *base,
+ int follow_links);
void dir_sort (struct dir_entry *e);
void dir_free (struct dir_entry **e_p);
int zebra_begin_read (ZebraHandle zh);
void zebra_end_read (ZebraHandle zh);
+int zebra_file_stat (const char *file_name, struct stat *buf,
+ int follow_links);
YAZ_END_CDECL
-/* $Id: main.c,v 1.95 2002-08-29 08:47:08 adam Exp $
+/* $Id: main.c,v 1.96 2002-09-03 11:44:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
rGroupDef.databaseNamePath = 0;
rGroupDef.explainDatabase = 0;
rGroupDef.fileVerboseLimit = 100000;
+ rGroupDef.followLinks = -1;
prog = *argv;
if (argc < 2)
" -s Show analysis on stdout, but do no work.\n"
" -v <level> Set logging to <level>.\n"
" -l <file> Write log to <file>.\n"
+ " -L Don't follow symbolic links.\n"
" -f <n> Display information for the first <n> records.\n"
" -V Show version.\n", *argv
);
exit (1);
}
- while ((ret = options ("sVt:c:g:d:m:v:nf:l:"
+ while ((ret = options ("sVt:c:g:d:m:v:nf:l:L"
, argv, argc, &arg)) != -2)
{
if (ret == 0)
rGroupDef.recordType = arg;
else if (ret == 'n')
disableCommit = 1;
+ else if (ret == 'L')
+ rGroupDef.followLinks = 0;
else
logf (LOG_WARN, "unknown option '-%s'", arg);
}
-/* $Id: trav.c,v 1.40 2002-08-02 19:26:55 adam Exp $
+/* $Id: trav.c,v 1.41 2002-09-03 11:44:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
02111-1307, USA.
*/
-
-
-
#include <stdio.h>
#include <assert.h>
#include <sys/types.h>
-#include <sys/stat.h>
#ifdef WIN32
#include <io.h>
#define S_ISREG(x) (x & _S_IFREG)
int i;
size_t rep_len = strlen (rep);
- e = dir_open (rep, zh->path_reg);
+ e = dir_open (rep, zh->path_reg, rGroup->followLinks);
if (!e)
return;
logf (LOG_LOG, "dir %s", rep);
size_t src_len = strlen (src);
sprintf (tmppath, "%s%s", base, src);
- e_src = dir_open (tmppath, zh->path_reg);
+ e_src = dir_open (tmppath, zh->path_reg, rGroup->followLinks);
logf (LOG_LOG, "dir %s", tmppath);
#if 0
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)
else
*src = '\0';
strcat (src, path);
- stat (src, &sbuf);
+ zebra_file_stat (src, &sbuf, rGroup->followLinks);
strcpy (src, path);
src_len = strlen (src);
else
*src = '\0';
strcat (src, path);
- stat (src, &sbuf);
+ zebra_file_stat (src, &sbuf, rGroup->followLinks);
strcpy (src, path);
-/* $Id: zebraapi.h,v 1.19 2002-08-02 19:26:56 adam Exp $
+/* $Id: zebraapi.h,v 1.20 2002-09-03 11:44:54 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
YAZ_BEGIN_CDECL
struct recordGroup {
- char *groupName;
- char *databaseName;
- char *path;
- char *recordId;
- char *recordType;
- int flagStoreData;
- int flagStoreKeys;
- int flagRw;
- int fileVerboseLimit;
- int databaseNamePath;
- int explainDatabase;
+ char *groupName;
+ char *databaseName;
+ char *path;
+ char *recordId;
+ char *recordType;
+ int flagStoreData;
+ int flagStoreKeys;
+ int flagRw;
+ int fileVerboseLimit;
+ int databaseNamePath;
+ int explainDatabase;
+ int followLinks;
};
/* Retrieval Record Descriptor */