-# $Id: Makefile,v 1.4 1995-12-14 11:09:50 quinn Exp $
+# $Id: Makefile,v 1.5 1996-02-20 16:33:02 quinn Exp $
SHELL=/bin/sh
RANLIB=ranlib
DEFS=$(INCLUDE)
LIB=../lib/libret.a
PO = d1_read.o d1_attset.o d1_tagset.o d1_absyn.o d1_grs.o \
- d1_matchstr.o d1_sutrs.o d1_varset.o d1_espec.o \
+ d1_sutrs.o d1_varset.o d1_espec.o \
d1_doespec.o d1_map.o d1_marc.o d1_write.o d1_expout.o
CPP=$(CC) -E
# Copyright (C) 1994, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.17 1995-11-08 17:41:43 quinn Exp $
+# $Id: Makefile,v 1.18 1996-02-20 16:33:06 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 tpath.o nmem.o # dmalloc.o
+ xmalloc.o readconf.o tpath.o nmem.o yaz-util.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: yaz-util.c,v $
+ * Revision 1.1 1996-02-20 16:33:06 quinn
+ * Moved matchstr to global util
+ *
+ * Revision 1.1 1995/11/01 11:56:08 quinn
+ * Added Retrieval (data management) functions en masse.
+ *
+ *
+ */
+
+#include <ctype.h>
+
+/*
+ * Match strings, independently of case and occurences of '-'.
+ * fairly inefficient - will be replaced with an indexing scheme for
+ * the various subsystems if we get a bottleneck here.
+ */
+
+int yaz_matchstr(char *s1, char *s2)
+{
+ while (*s1 && *s2)
+ {
+ char c1, c2;
+
+ if (*s1 == '-')
+ s1++;
+ if (*s2 == '-')
+ s2++;
+ if (!*s1 || !*s2)
+ break;
+ c1 = *s1;
+ c2 = *s2;
+ if (isupper(c1))
+ c1 = tolower(c1);
+ if (isupper(c2))
+ c2 = tolower(c2);
+ if (c1 != c2)
+ break;
+ s1++;
+ s2++;
+ }
+ return *s1 || *s2;
+}