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