Added DLL entry point routines.
[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.4  1997-05-01 15:07:55  adam
8  * Added DLL entry point routines.
9  *
10  * Revision 1.3  1996/10/29 13:36:28  adam
11  * Added header.
12  *
13  * Revision 1.2  1996/02/20 17:58:42  adam
14  * Added const to yaz_matchstr.
15  *
16  * Revision 1.1  1996/02/20  16:33:06  quinn
17  * Moved matchstr to global util
18  *
19  * Revision 1.1  1995/11/01  11:56:08  quinn
20  * Added Retrieval (data management) functions en masse.
21  *
22  *
23  */
24
25 #include <ctype.h>
26 #include <yaz-util.h>
27 /*
28  * Match strings, independently of case and occurences of '-'.
29  * fairly inefficient - will be replaced with an indexing scheme for
30  * the various subsystems if we get a bottleneck here.
31  */
32
33 int yaz_matchstr(const char *s1, const char *s2)
34 {
35     while (*s1 && *s2)
36     {
37         char c1, c2;
38
39         if (*s1 == '-')
40             s1++;
41         if (*s2 == '-')
42             s2++;
43         if (!*s1 || !*s2)
44             break;
45         c1 = *s1;
46         c2 = *s2;
47         if (isupper(c1))
48             c1 = tolower(c1);
49         if (isupper(c2))
50             c2 = tolower(c2);
51         if (c1 != c2)
52             break;
53         s1++;
54         s2++;
55     }
56     return *s1 || *s2;
57 }
58
59
60 #ifdef WINDOWS
61  
62 #include <windows.h>
63 BOOL APIENTRY DllMain(hInst, reason, reserved)
64     HINSTANCE hInst; /* Library instance handle. */
65     DWORD reason;    /* Reason this function is being called. */
66     LPVOID reserved; /* Not used. */
67 {
68     return TRUE;
69 }
70  
71 BOOL APIENTRY DllEntryPoint(hInst, reason, reserved)
72     HINSTANCE hInst; /* Library instance handle. */
73     DWORD reason;    /* Reason this function is being called. */
74     LPVOID reserved; /* Not used. */
75 {
76     return TRUE;
77 }                                                                              
78 #endif
79