Minor changes. Dictionary is lower case now.
[idzebra-moved-to-github.git] / index / kcompare.c
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: kcompare.c,v $
7  * Revision 1.4  1995-09-08 14:52:27  adam
8  * Minor changes. Dictionary is lower case now.
9  *
10  * Revision 1.3  1995/09/07  13:58:36  adam
11  * New parameter: result-set file descriptor (RSFD) to support multiple
12  * positions within the same result-set.
13  * Boolean operators: and, or, not implemented.
14  * Result-set references.
15  *
16  * Revision 1.2  1995/09/06  16:11:17  adam
17  * Option: only one word key per file.
18  *
19  * Revision 1.1  1995/09/04  09:10:36  adam
20  * More work on index add/del/update.
21  * Merge sort implemented.
22  * Initial work on z39 server.
23  *
24  */
25
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdio.h>
29 #include <ctype.h>
30 #include <assert.h>
31
32 #include "index.h"
33
34 int key_compare (const void *p1, const void *p2)
35 {
36     struct it_key i1, i2;
37     memcpy (&i1, p1, sizeof(i1));
38     memcpy (&i2, p2, sizeof(i2));
39     if (i1.sysno != i2.sysno)
40     {
41         if (i1.sysno > i2.sysno)
42             return 2;
43         else
44             return -2;
45     }
46     if (i1.seqno != i2.seqno)
47     {
48         if (i1.seqno > i2.seqno)
49             return 1;
50         else
51             return -1;
52     }
53 #if IT_KEY_HAVE_FIELD
54     if (i1.field != i2.field)
55     {
56         if (i1.field > i2.field)
57             return 1;
58         else
59             return -1;
60     }
61 #endif
62     return 0;
63 }
64
65 int index_char_cvt (int c)
66 {
67     return tolower (c);
68 }