* OF THIS SOFTWARE.
*
* $Log: data1.h,v $
- * Revision 1.2 1995-11-01 13:54:35 quinn
+ * Revision 1.3 1995-11-01 16:34:52 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:35 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 13:07:18 quinn
#include <d1_attset.h>
#include <d1_map.h>
+extern char *data1_tabpath; /* global path for tables */
+
#define DATA1_MAX_SYMBOL 31
typedef struct data1_name
--- /dev/null
+/*
+ * Copyright (c) 1995, Index Data.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation, in whole or in part, for any purpose, is hereby granted,
+ * provided that:
+ *
+ * 1. This copyright and permission notice appear in all copies of the
+ * software and its documentation. Notices of copyright or attribution
+ * which appear at the beginning of any file must remain unchanged.
+ *
+ * 2. The names of Index Data or the individual authors may not be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
+ * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ *
+ */
+
+FILE *yaz_path_fopen(char *path, char *name, char *mode);
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_absyn.c,v $
- * Revision 1.2 1995-11-01 13:54:44 quinn
+ * Revision 1.3 1995-11-01 16:34:55 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:44 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:06 quinn
#include <xmalloc.h>
#include <oid.h>
#include <log.h>
+#include <tpath.h>
#include <data1.h>
data1_marctab **marcp;
int level = 0;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_attset.c,v $
- * Revision 1.1 1995-11-01 11:56:07 quinn
+ * Revision 1.2 1995-11-01 16:34:55 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.1 1995/11/01 11:56:07 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <xmalloc.h>
#include <log.h>
#include <d1_attset.h>
+#include <data1.h>
+#include <tpath.h>
data1_att *data1_getattbyname(data1_attset *s, char *name)
{
data1_att **attp;
FILE *f;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_espec.c,v $
- * Revision 1.1 1995-11-01 11:56:07 quinn
+ * Revision 1.2 1995-11-01 16:34:56 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.1 1995/11/01 11:56:07 quinn
* Added Retrieval (data management) functions en masse.
*
*
#include <proto.h>
#include <log.h>
#include <readconf.h>
+#include <tpath.h>
+#include <data1.h>
/*
* Read an element-set specification from a file. If !o, use xmalloc for
char *argv[50], line[512];
Z_Espec1 *res = odr_malloc(o, sizeof(*res));
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_map.c,v $
- * Revision 1.2 1995-11-01 13:54:46 quinn
+ * Revision 1.3 1995-11-01 16:34:56 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:46 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:08 quinn
#include <log.h>
#include <readconf.h>
+#include <tpath.h>
#include <data1.h>
#include "d1_map.h"
char *argv[50], line[512];
data1_mapunit **mapp;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_marc.c,v $
- * Revision 1.2 1995-11-01 13:54:48 quinn
+ * Revision 1.3 1995-11-01 16:34:57 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:48 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:08 quinn
#include <readconf.h>
#include <xmalloc.h>
#include <data1.h>
+#include <tpath.h>
#define ISO2709_RS 035
#define ISO2709_FS 036
char line[512], *argv[50];
int argc;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_read.c,v $
- * Revision 1.2 1995-11-01 13:54:48 quinn
+ * Revision 1.3 1995-11-01 16:34:57 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:48 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:09 quinn
#include <log.h>
#include <data1.h>
+char *data1_tabpath = 0; /* global path for tables */
+
+void data1_set_tabpath(char *p)
+{ data1_tabpath = p; }
+
static data1_node *freelist = 0;
/*
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_tagset.c,v $
- * Revision 1.2 1995-11-01 13:54:49 quinn
+ * Revision 1.3 1995-11-01 16:34:58 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:49 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:09 quinn
#include <xmalloc.h>
#include <log.h>
+#include <tpath.h>
#include <data1.h>
data1_tag **tagp;
FILE *f;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_varset.c,v $
- * Revision 1.2 1995-11-01 13:54:50 quinn
+ * Revision 1.3 1995-11-01 16:34:58 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ * Revision 1.2 1995/11/01 13:54:50 quinn
* Minor adjustments
*
* Revision 1.1 1995/11/01 11:56:09 quinn
#include <oid.h>
#include <log.h>
+#include <tpath.h>
#include <data1.h>
data1_vartype *data1_getvartypebyct(data1_varset *set, char *class, char *type)
res->reference = VAL_NONE;
res->classes = 0;
- if (!(f = fopen(file, "r")))
+ if (!(f = yaz_path_fopen(data1_tabpath, file, "r")))
{
logf(LOG_WARN|LOG_ERRNO, "%s", file);
return 0;
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.15 1995-11-01 13:55:04 quinn Exp $
+# $Id: Makefile,v 1.16 1995-11-01 16:34:59 quinn Exp $
SHELL=/bin/sh
INCLUDE=-I../include -I.
LIB=$(LIBDIR)/libutil.a
LIBS=
PO = options.o log.o marcdisp.o yaz-ccl.o pquery.o oid.o wrbuf.o \
- xmalloc.o readconf.o # dmalloc.o
+ xmalloc.o readconf.o tpath.o # dmalloc.o
CPP=$(CC) -E
RANLIB=ranlib
--- /dev/null
+/*
+ * Copyright (c) 1995, Index Data.
+ * See the file LICENSE for details.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: tpath.c,v $
+ * Revision 1.1 1995-11-01 16:35:00 quinn
+ * Making data1 look for tables in data1_tabpath
+ *
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+FILE *yaz_path_fopen(char *path, char *name, char *mode)
+{
+ char spath[512] = "";
+
+ if (!path)
+ return fopen(name, mode);
+
+ do
+ {
+ FILE *f;
+
+ if (sscanf(path, "%511[^:]", spath) < 1)
+ return 0;
+ sprintf(spath + strlen(spath), "/%s", name);
+ if ((f = fopen(spath, mode)))
+ return f;
+ if ((path = strchr(path, ':')))
+ path++;
+ }
+ while (path);
+ return 0;
+}