Removed windows DLL stubs.
[yaz-moved-to-github.git] / util / yaz-util.c
1 /*
2  * Copyright (c) 1995-1997, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: yaz-util.c,v $
7  * Revision 1.5  1997-07-21 12:48:11  adam
8  * Removed windows DLL stubs.
9  *
10  * Revision 1.4  1997/05/01 15:07:55  adam
11  * Added DLL entry point routines.
12  *
13  * Revision 1.3  1996/10/29 13:36:28  adam
14  * Added header.
15  *
16  * Revision 1.2  1996/02/20 17:58:42  adam
17  * Added const to yaz_matchstr.
18  *
19  * Revision 1.1  1996/02/20  16:33:06  quinn
20  * Moved matchstr to global util
21  *
22  * Revision 1.1  1995/11/01  11:56:08  quinn
23  * Added Retrieval (data management) functions en masse.
24  *
25  *
26  */
27
28 #include <ctype.h>
29 #include <yaz-util.h>
30 /*
31  * Match strings, independently of case and occurences of '-'.
32  * fairly inefficient - will be replaced with an indexing scheme for
33  * the various subsystems if we get a bottleneck here.
34  */
35
36 int yaz_matchstr(const char *s1, const char *s2)
37 {
38     while (*s1 && *s2)
39     {
40         char c1, c2;
41
42         if (*s1 == '-')
43             s1++;
44         if (*s2 == '-')
45             s2++;
46         if (!*s1 || !*s2)
47             break;
48         c1 = *s1;
49         c2 = *s2;
50         if (isupper(c1))
51             c1 = tolower(c1);
52         if (isupper(c2))
53             c2 = tolower(c2);
54         if (c1 != c2)
55             break;
56         s1++;
57         s2++;
58     }
59     return *s1 || *s2;
60 }