* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mfile.c,v $
- * Revision 1.42 2002-04-04 14:14:13 adam
+ * Revision 1.43 2002-04-04 20:50:36 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.42 2002/04/04 14:14:13 adam
* Multiple registers (alpha early)
*
* Revision 1.41 2000/11/29 14:24:01 adam
ad++;
if (!*ad)
break;
- if (!zebra_is_abspath(ad) && base)
+ if (!yaz_is_abspath(ad) && base)
{
strcpy (dirname, base);
i = strlen(dirname);
* OF THIS SOFTWARE.
*
* $Log: charmap.h,v $
- * Revision 1.6 1999-11-30 13:48:03 adam
+ * Revision 1.7 2002-04-04 20:50:36 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.6 1999/11/30 13:48:03 adam
* Improved installation. Updated for inclusion of YAZ header files.
*
* Revision 1.5 1999/09/07 07:19:21 adam
typedef struct chrmaptab_info *chrmaptab;
YAZ_EXPORT chrmaptab chrmaptab_create(const char *tabpath, const char *name,
- int map_only);
+ int map_only, const char *tabroot);
YAZ_EXPORT void chrmaptab_destroy (chrmaptab tab);
YAZ_EXPORT const char **chr_map_input(chrmaptab t, const char **from, int len);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: direntz.h,v $
- * Revision 1.5 2002-04-04 14:14:13 adam
+ * Revision 1.6 2002-04-04 20:50:36 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.5 2002/04/04 14:14:13 adam
* Multiple registers (alpha early)
*
* Revision 1.4 1999/05/26 07:49:13 adam
#include <dirent.h>
#endif
-int zebra_is_abspath (const char *p);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.h,v $
- * Revision 1.12 2001-11-14 22:06:27 adam
+ * Revision 1.13 2002-04-04 20:50:36 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.12 2001/11/14 22:06:27 adam
* Rank-weight may be controlled via query.
*
* Revision 1.11 2001/01/22 10:42:56 adam
#endif
typedef struct zebra_maps *ZebraMaps;
-ZebraMaps zebra_maps_open (Res res);
+ZebraMaps zebra_maps_open (Res res, const char *base);
void zebra_maps_close (ZebraMaps zm);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: dir.c,v $
- * Revision 1.21 1999-05-26 07:49:13 adam
+ * Revision 1.22 2002-04-04 20:50:36 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.21 1999/05/26 07:49:13 adam
* C++ compilation.
*
* Revision 1.20 1999/02/02 14:50:50 adam
#include "index.h"
-struct dir_entry *dir_open (const char *rep)
+struct dir_entry *dir_open (const char *rep, const char *base)
{
DIR *dir;
- char path[256];
+ char path[1024];
+ char full_rep[1024];
size_t pathpos;
struct dirent *dent;
size_t entry_max = 500;
size_t idx = 0;
struct dir_entry *entry;
- logf (LOG_DEBUG, "dir_open %s", rep);
- if (!(dir = opendir(rep)))
+ if (base && !yaz_is_abspath(rep))
+ {
+ strcpy (full_rep, base);
+ strcat (full_rep, "/");
+ }
+ else
+ *full_rep = '\0';
+ strcat (full_rep, rep);
+
+ logf (LOG_LOG, "dir_open %s", full_rep);
+ if (!(dir = opendir(full_rep)))
{
logf (LOG_WARN|LOG_ERRNO, "opendir %s", rep);
if (errno != ENOENT && errno != EACCES)
entry = entry_n;
}
strcpy (path + pathpos, dent->d_name);
- stat (path, &finfo);
+
+ if (base && !yaz_is_abspath (path))
+ {
+ strcpy (full_rep, base);
+ strcat (full_rep, "/");
+ strcat (full_rep, path);
+ stat (full_rep, &finfo);
+ }
+ else
+ stat (path, &finfo);
switch (finfo.st_mode & S_IFMT)
{
case S_IFREG:
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: extract.c,v 1.114 2002-04-04 14:14:13 adam Exp $
+ * $Id: extract.c,v 1.115 2002-04-04 20:50:36 adam Exp $
*/
#include <stdio.h>
#include <assert.h>
#include <fcntl.h>
#include "index.h"
+#include <direntz.h>
#include <charmap.h>
#if _FILE_OFFSET_BITS == 64
fd = -1;
else
{
- if ((fd = open (fname, O_BINARY|O_RDONLY)) == -1)
+ char full_rep[1024];
+
+ if (zh->path_reg && !yaz_is_abspath (fname))
+ {
+ strcpy (full_rep, zh->path_reg);
+ strcat (full_rep, "/");
+ strcat (full_rep, fname);
+ }
+ else
+ strcpy (full_rep, fname);
+
+
+ if ((fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
- logf (LOG_WARN|LOG_ERRNO, "open %s", fname);
+ logf (LOG_WARN|LOG_ERRNO, "open %s", full_rep);
return 0;
}
}
* Copyright (C) 1995-2002, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss, Heikki Levanto
- * $Id: index.h,v 1.75 2002-04-04 14:14:13 adam Exp $
+ * $Id: index.h,v 1.76 2002-04-04 20:50:37 adam Exp $
*/
#ifndef INDEX_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);
+struct dir_entry *dir_open (const char *rep, const char *base);
void dir_sort (struct dir_entry *e);
void dir_free (struct dir_entry **e_p);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: kdump.c,v $
- * Revision 1.20 2002-04-04 14:14:13 adam
+ * Revision 1.21 2002-04-04 20:50:37 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.20 2002/04/04 14:14:13 adam
* Multiple registers (alpha early)
*
* Revision 1.19 2000/12/05 10:01:44 adam
}
if (!res)
res = res_open ("zebra.cfg", 0);
- zm = zebra_maps_open (res);
+ zm = zebra_maps_open (res, 0);
if (!(inf = fopen (key_fname, "r")))
{
logf (LOG_FATAL|LOG_ERRNO, "fopen %s", key_fname);
* Copyright (C) 1994-2002, Index Data
* All rights reserved.
*
- * $Id: main.c,v 1.83 2002-04-04 14:14:13 adam Exp $
+ * $Id: main.c,v 1.84 2002-04-04 20:50:37 adam Exp $
*/
#include <stdio.h>
#include <string.h>
ZEBRAVER, ZEBRADATE);
#endif
zs = zebra_start (configName ? configName : "zebra.cfg");
-
+ if (!zs)
+ exit (1);
zh = zebra_open (zs);
}
if (rGroupDef.databaseName)
- zebra_select_database (zh, rGroupDef.databaseName);
+ {
+ if (zebra_select_database (zh, rGroupDef.databaseName))
+ exit (1);
+ }
else
- zebra_select_database (zh, "Default");
+ {
+ if (zebra_select_database (zh, "Default"))
+ exit (1);
+ }
if (!strcmp (arg, "update"))
cmd = 'u';
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: retrieve.c,v $
- * Revision 1.15 2002-04-04 14:14:13 adam
+ * Revision 1.16 2002-04-04 20:50:37 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.15 2002/04/04 14:14:13 adam
* Multiple registers (alpha early)
*
* Revision 1.14 2001/01/22 11:41:41 adam
#endif
#include "index.h"
+#include <direntz.h>
int zebra_record_ext_read (void *fh, char *buf, size_t count)
{
}
else
{
- if ((fc.fd = open (fname, O_BINARY|O_RDONLY)) == -1)
+ char full_rep[1024];
+
+ if (zh->path_reg && !yaz_is_abspath (fname))
+ {
+ strcpy (full_rep, zh->path_reg);
+ strcat (full_rep, "/");
+ strcat (full_rep, fname);
+ }
+ else
+ strcpy (full_rep, fname);
+
+
+ if ((fc.fd = open (full_rep, O_BINARY|O_RDONLY)) == -1)
{
logf (LOG_WARN|LOG_ERRNO, "Retrieve fail; missing file: %s",
- fname);
+ full_rep);
rec_rm (&rec);
return 14;
}
/*
- * Copyright (C) 1994-1999, Index Data
+ * Copyright (C) 1994-2002, Index Data
* All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Log: trav.c,v $
- * Revision 1.38 2002-04-04 14:14:13 adam
- * Multiple registers (alpha early)
- *
- * Revision 1.37 2002/02/20 17:30:01 adam
- * Work on new API. Locking system re-implemented
- *
- * Revision 1.36 1999/05/15 14:36:38 adam
- * Updated dictionary. Implemented "compression" of dictionary.
- *
- * Revision 1.35 1999/02/02 14:51:09 adam
- * Updated WIN32 code specific sections. Changed header.
- *
- * Revision 1.34 1998/06/08 14:43:14 adam
- * Added suport for EXPLAIN Proxy servers - added settings databasePath
- * and explainDatabase to facilitate this. Increased maximum number
- * of databases and attributes in one register.
- *
- * Revision 1.33 1998/01/12 15:04:08 adam
- * The test option (-s) only uses read-lock (and not write lock).
- *
- * Revision 1.32 1997/09/25 14:56:51 adam
- * Windows NT interface code to the stat call.
- *
- * Revision 1.31 1997/09/17 12:19:17 adam
- * Zebra version corresponds to YAZ version 1.4.
- * Changed Zebra server so that it doesn't depend on global common_resource.
- *
- * Revision 1.30 1997/09/09 13:38:09 adam
- * Partial port to WIN95/NT.
- *
- * Revision 1.29 1997/02/12 20:39:47 adam
- * Implemented options -f <n> that limits the log to the first <n>
- * records.
- * Changed some log messages also.
- *
- * Revision 1.28 1996/11/01 08:58:44 adam
- * Interface to isamc system now includes update and delete.
- *
- * Revision 1.27 1996/10/29 14:06:56 adam
- * Include zebrautl.h instead of alexutil.h.
- *
- * Revision 1.26 1996/06/04 10:19:01 adam
- * Minor changes - removed include of ctype.h.
- *
- * Revision 1.25 1996/05/01 13:46:37 adam
- * First work on multiple records in one file.
- * New option, -offset, to the "unread" command in the filter module.
- *
- * Revision 1.24 1996/04/26 10:00:23 adam
- * Added option -V to zebraidx to display version information.
- * Removed stupid warnings from file update.
- *
- * Revision 1.23 1996/04/12 07:02:25 adam
- * File update of single files.
- *
- * Revision 1.22 1996/04/09 06:50:50 adam
- * Bug fix: bad reference in function fileUpdateR.
- *
- * Revision 1.21 1996/03/22 15:34:18 quinn
- * Fixed bad reference
- *
- * Revision 1.20 1996/03/21 14:50:10 adam
- * File update uses modify-time instead of change-time.
- *
- * Revision 1.19 1996/03/20 16:16:55 quinn
- * Added diagnostic output
- *
- * Revision 1.18 1996/03/19 12:43:27 adam
- * Bug fix: File update traversal didn't handle trailing slashes correctly.
- * Bug fix: Update of sub directory groups wasn't handled correctly.
- *
- * Revision 1.17 1996/02/12 18:45:17 adam
- * Changed naming of some functions.
- *
- * Revision 1.16 1996/02/05 12:30:02 adam
- * Logging reduced a bit.
- * The remaining running time is estimated during register merge.
- *
- * Revision 1.15 1995/12/07 17:38:48 adam
- * Work locking mechanisms for concurrent updates/commit.
- *
- * Revision 1.14 1995/12/06 12:41:26 adam
- * New command 'stat' for the index program.
- * Filenames can be read from stdin by specifying '-'.
- * Bug fix/enhancement of the transformation from terms to regular
- * expressons in the search engine.
- *
- * Revision 1.13 1995/11/28 09:09:46 adam
- * Zebra config renamed.
- * Use setting 'recordId' to identify record now.
- * Bug fix in recindex.c: rec_release_blocks was invokeded even
- * though the blocks were already released.
- * File traversal properly deletes records when needed.
- *
- * Revision 1.12 1995/11/24 11:31:37 adam
- * Commands add & del read filenames from stdin if source directory is
- * empty.
- * Match criteria supports 'constant' strings.
- *
- * Revision 1.11 1995/11/22 17:19:19 adam
- * Record management uses the bfile system.
- *
- * Revision 1.10 1995/11/21 15:01:16 adam
- * New general match criteria implemented.
- * New feature: document groups.
- *
- * Revision 1.9 1995/11/21 09:20:32 adam
- * Yet more work on record match.
- *
- * Revision 1.8 1995/11/20 16:59:46 adam
- * New update method: the 'old' keys are saved for each records.
- *
- * Revision 1.7 1995/11/20 11:56:28 adam
- * Work on new traversal.
- *
- * Revision 1.6 1995/11/17 15:54:42 adam
- * Started work on virtual directory structure.
- *
- * Revision 1.5 1995/10/17 18:02:09 adam
- * New feature: databases. Implemented as prefix to words in dictionary.
- *
- * Revision 1.4 1995/09/28 09:19:46 adam
- * xfree/xmalloc used everywhere.
- * Extract/retrieve method seems to work for text records.
- *
- * Revision 1.3 1995/09/06 16:11:18 adam
- * Option: only one word key per file.
- *
- * Revision 1.2 1995/09/04 12:33:43 adam
- * Various cleanup. YAZ util used instead.
- *
- * Revision 1.1 1995/09/01 14:06:36 adam
- * Split of work into more files.
*
+ * $Id: trav.c,v 1.39 2002-04-04 20:50:37 adam Exp $
*/
int i;
size_t rep_len = strlen (rep);
- e = dir_open (rep);
+ e = dir_open (rep, zh->path_reg);
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);
+ e_src = dir_open (tmppath, zh->path_reg);
logf (LOG_LOG, "dir %s", tmppath);
#if 0
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);
+ stat (src, &sbuf);
+
strcpy (src, path);
src_len = strlen (src);
- stat (src, &sbuf);
if (S_ISREG(sbuf.st_mode))
{
struct dirs_entry *e_dst;
char src[1024];
assert (path);
- strcpy (src, path);
+ if (zh->path_reg && !yaz_is_abspath(path))
+ {
+ strcpy (src, zh->path_reg);
+ strcat (src, "/");
+ }
+ else
+ *src = '\0';
+ strcat (src, path);
stat (src, &sbuf);
+
+ strcpy (src, path);
+
if (S_ISREG(sbuf.st_mode))
fileExtract (zh, NULL, src, rGroup, deleteFlag);
else if (S_ISDIR(sbuf.st_mode))
{
char src[1024];
- while (scanf ("%s", src) == 1)
+ while (scanf ("%1020s", src) == 1)
repositoryExtract (zh, deleteFlag, rGroup, src);
}
else
* Copyright (C) 1995-2002, Index Data
* All rights reserved.
*
- * $Id: zebraapi.c,v 1.51 2002-04-04 14:14:13 adam Exp $
+ * $Id: zebraapi.c,v 1.52 2002-04-04 20:50:37 adam Exp $
*/
#include <assert.h>
#endif
}
-
static void zebra_flush_reg (ZebraHandle zh)
{
zebraExplain_flush (zh->reg->zei, 1, zh);
zebra_index_merge (zh);
}
-
static struct zebra_register *zebra_register_open (ZebraService zs,
const char *name,
int rw, int useshadow,
{
ZebraHandle zh;
- assert (zs);
+ if (!zs)
+ return 0;
zh = (ZebraHandle) xmalloc (sizeof(*zh));
yaz_log (LOG_LOG, "zebra_open zs=%p returns %p", zs, zh);
ZebraService zebra_start (const char *configName)
{
- ZebraService zh = xmalloc (sizeof(*zh));
+ Res res;
yaz_log (LOG_LOG, "zebra_start %s", configName);
- zh->configName = xstrdup(configName);
- zh->sessions = 0;
-
- if (!(zh->global_res = res_open (zh->configName, 0)))
- {
- logf (LOG_WARN, "Failed to read resources `%s'", zh->configName);
- }
+ if (!(res = res_open (configName, 0)))
+ yaz_log (LOG_WARN, "Cannot read resources `%s'", configName);
else
{
- logf (LOG_LOG, "Read resources `%s'", zh->configName);
- }
- zebra_chdir (zh);
+ ZebraService zh = xmalloc (sizeof(*zh));
- zebra_mutex_cond_init (&zh->session_lock);
- if (!res_get (zh->global_res, "passwd"))
- zh->passwd_db = NULL;
- else
- {
- zh->passwd_db = passwd_db_open ();
- if (!zh->passwd_db)
- logf (LOG_WARN|LOG_ERRNO, "passwd_db_open failed");
- else
- passwd_db_file (zh->passwd_db, res_get (zh->global_res, "passwd"));
+ yaz_log (LOG_LOG, "Read resources `%s'", configName);
+
+ zh->global_res = res;
+ zh->configName = xstrdup(configName);
+ zh->sessions = 0;
+
+ zebra_chdir (zh);
+
+ zebra_mutex_cond_init (&zh->session_lock);
+ if (!res_get (zh->global_res, "passwd"))
+ zh->passwd_db = NULL;
+ else
+ {
+ zh->passwd_db = passwd_db_open ();
+ if (!zh->passwd_db)
+ logf (LOG_WARN|LOG_ERRNO, "passwd_db_open failed");
+ else
+ passwd_db_file (zh->passwd_db,
+ res_get (zh->global_res, "passwd"));
+ }
+ zh->path_root = res_get (zh->global_res, "root");
+ return zh;
}
- zh->path_root = res_get (zh->global_res, "root");
- return zh;
+ return 0;
}
static
if (useshadow)
bf_cache (reg->bfs, res_get (res, "shadow"));
data1_set_tabpath (reg->dh, res_get(res, "profilePath"));
+ data1_set_tabroot (reg->dh, reg_path);
reg->recTypes = recTypes_init (reg->dh);
recTypes_default_handlers (reg->recTypes);
- reg->zebra_maps = zebra_maps_open (res);
+ reg->zebra_maps = zebra_maps_open (res, reg_path);
reg->rank_classes = NULL;
reg->key_buf = 0;
{
Res res = 0;
char fname[512];
- if (*zh->reg_name == 0)
- {
- res = zh->service->global_res;
- yaz_log (LOG_LOG, "local res = global res");
- }
- else if (zh->path_reg)
+ if (zh->path_reg)
{
sprintf (fname, "%.200s/zebra.cfg", zh->path_reg);
- yaz_log (LOG_LOG, "res_open(%s)", fname);
res = res_open (fname, zh->service->global_res);
if (!res)
- return 0;
+ res = zh->service->global_res;
+ }
+ else if (*zh->reg_name == 0)
+ {
+ res = zh->service->global_res;
}
else
+ {
+ yaz_log (LOG_WARN, "no register root specified");
return 0; /* no path for register - fail! */
+ }
return res;
}
zebra_end_read (zh);
- logf(LOG_APP,"SEARCH:%d:",zh->hits);
*hits = zh->hits;
}
* Copyright (C) 1995-2000, Index Data
* All rights reserved.
*
- * $Id: zserver.c,v 1.85 2002-04-04 14:14:13 adam Exp $
+ * $Id: zserver.c,v 1.86 2002-04-04 20:50:37 adam Exp $
*/
#include <stdio.h>
sob = statserv_getcontrol ();
if (!(zh = zebra_open (sob->handle)))
{
- logf (LOG_FATAL, "Failed to open Zebra `%s'", sob->configname);
+ yaz_log (LOG_FATAL, "Failed to open config `%s'", sob->configname);
r->errcode = 1;
return r;
}
ZebraHandle zh = (ZebraHandle) handle;
int is_partial, i;
- zebra_select_databases (zh, r->num_bases, (const char **) r->basenames);
-
+ if (zebra_select_databases (zh, r->num_bases,
+ (const char **) r->basenames))
+ {
+ zebra_result (zh, &r->errcode, &r->errstring);
+ return 0;
+ }
r->entries = (struct scan_entry *)
odr_malloc (r->stream, sizeof(*r->entries) * r->num_entries);
zebra_scan (zh, r->stream, r->term,
* All rights reserved.
*
* $Log: regxread.c,v $
- * Revision 1.37 2001-05-29 08:51:59 adam
+ * Revision 1.38 2002-04-04 20:50:37 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.37 2001/05/29 08:51:59 adam
* More fixes for character encodings.
*
* Revision 1.36 2001/05/22 21:02:26 adam
if (spec->tcl_interp)
{
sprintf (fname, "%s.tflt", spec->name);
- spec_inf = yaz_path_fopen (data1_get_tabpath(spec->dh), fname, "r");
+ spec_inf = data1_path_fopen (spec->dh, fname, "r");
}
#endif
if (!spec_inf)
{
sprintf (fname, "%s.flt", spec->name);
- spec_inf = yaz_path_fopen (data1_get_tabpath(spec->dh), fname, "r");
+ spec_inf = data1_path_fopen (spec->dh, fname, "r");
}
if (!spec_inf)
{
# Simple Zebra configuration file
-# $Id: zebra.cfg,v 1.11 2000-12-01 17:59:08 adam Exp $
+# $Id: zebra.cfg,v 1.12 2002-04-04 20:50:37 adam Exp $
#
# Where the schema files, attribute files, etc are located.
profilePath: .:../../tab:../../../yaz/tab
recordtype: grs.sgml
storekeys: 1
-storedata: 1
+#storedata: 1
+recordId: file
#recordId: (bib1,identifier-standard)
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: charmap.c,v 1.19 2002-02-18 11:47:23 adam Exp $
+ * $Id: charmap.c,v 1.20 2002-04-04 20:50:37 adam Exp $
*
*/
return 0;
}
-chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only)
+chrmaptab chrmaptab_create(const char *tabpath, const char *name, int map_only,
+ const char *tabroot)
{
FILE *f;
char line[512], *argv[50];
NMEM nmem;
logf (LOG_DEBUG, "maptab %s open", name);
- if (!(f = yaz_path_fopen(tabpath, name, "r")))
+ if (!(f = yaz_path_fopen_base(tabpath, name, "r", tabroot)))
{
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return 0;
/*
- * Copyright (C) 1997-1999, Index Data
+ * Copyright (C) 1997-2002, Index Data
* All rights reserved.
- * Sebastian Hammer, Adam Dickmeiss
*
- * $Log: dirent.c,v $
- * Revision 1.4 2002-04-04 14:14:14 adam
- * Multiple registers (alpha early)
- *
- * Revision 1.3 1999/02/02 14:51:38 adam
- * Updated WIN32 code specific sections. Changed header.
- *
- * Revision 1.2 1997/09/17 12:19:24 adam
- * Zebra version corresponds to YAZ version 1.4.
- * Changed Zebra server so that it doesn't depend on global common_resource.
- *
- *
+ * $Id: dirent.c,v 1.5 2002-04-04 20:50:37 adam Exp $
*
* This utility implements a opendir/readdir/close on Windows.
*/
-#ifdef WIN32
+#include <ctype.h>
#include <assert.h>
+#ifdef WIN32
#include <io.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <direntz.h>
+#ifdef WIN32
+
struct DIR {
HANDLE handle;
WIN32_FIND_DATA find_data;
#endif
-int zebra_is_abspath (const char *p)
-{
- if (*p == '/')
- return 1;
-#ifdef WIN32
- if (*p == '\\')
- return 1;
- if (*p && p[1] == ':' && isalpha(*p))
- return 1;
-#endif
- return 0;
-}
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: res.c,v 1.29 2002-04-04 14:14:14 adam Exp $
+ * $Id: res.c,v 1.30 2002-04-04 20:50:37 adam Exp $
*/
#include <stdio.h>
#include <stdlib.h>
if (access (name, R_OK))
#endif
{
- logf (LOG_LOG|LOG_ERRNO, "Cannot access resource file `%s'", name);
+ logf (LOG_WARN|LOG_ERRNO, "Cannot access resource file `%s'", name);
return 0;
}
r = (Res) xmalloc (sizeof(*r));
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zebramap.c,v $
- * Revision 1.23 2001-11-15 08:41:24 adam
+ * Revision 1.24 2002-04-04 20:50:37 adam
+ * Multi register works with record paths and data1 profile path
+ *
+ * Revision 1.23 2001/11/15 08:41:24 adam
* Fix for weight (bug introduced by previous commit).
*
* Revision 1.22 2001/11/14 22:06:27 adam
struct zebra_maps {
char *tabpath;
+ char *tabroot;
NMEM nmem;
struct zebra_map *map_list;
char temp_map_str[2];
int lineno = 0;
struct zebra_map **zm = 0, *zp;
- if (!(f = yaz_path_fopen(zms->tabpath, name, "r")))
+ if (!(f = yaz_path_fopen_base(zms->tabpath, name, "r", zms->tabroot)))
{
logf(LOG_WARN|LOG_ERRNO, "%s", name);
return ;
zebra_map_read (zms, value);
}
-ZebraMaps zebra_maps_open (Res res)
+ZebraMaps zebra_maps_open (Res res, const char *base)
{
ZebraMaps zms = (ZebraMaps) xmalloc (sizeof(*zms));
int i;
zms->nmem = nmem_create ();
zms->tabpath = nmem_strdup (zms->nmem,
res_get_def (res, "profilePath", "."));
+ zms->tabroot = 0;
+ if (base)
+ zms->tabroot = nmem_strdup (zms->nmem, base);
zms->map_list = NULL;
zms->temp_map_str[0] = '\0';
zms->wrbuf_1 = wrbuf_alloc();
zms->wrbuf_2 = wrbuf_alloc();
+
return zms;
}
if (!zm->maptab_name || !yaz_matchstr (zm->maptab_name, "@"))
return NULL;
if (!(zm->maptab = chrmaptab_create (zms->tabpath,
- zm->maptab_name, 0)))
+ zm->maptab_name, 0,
+ zms->tabroot)))
logf(LOG_WARN, "Failed to read character table %s",
zm->maptab_name);
else