YAZ
4.2.57
Main Page
Data Structures
Files
File List
Globals
src
cclstr.c
Go to the documentation of this file.
1
/* This file is part of the YAZ toolkit.
2
* Copyright (C) 1995-2013 Index Data
3
* See the file LICENSE for details.
4
*/
9
#if HAVE_CONFIG_H
10
#include <
config.h
>
11
#endif
12
#include <
yaz/yaz-iconv.h
>
13
#include <stdio.h>
14
#include <stdlib.h>
15
16
#include <
yaz/ccl.h
>
17
18
static
int
ccli_toupper
(
int
c)
19
{
20
if
(
yaz_islower
(c))
21
return
yaz_toupper
(c);
22
else
23
return
c;
24
}
25
26
int (*
ccl_toupper
)(
int
c) = NULL;
27
28
int
ccl_stricmp
(
const
char
*s1,
const
char
*s2)
29
{
30
if
(!
ccl_toupper
)
31
ccl_toupper
=
ccli_toupper
;
32
while
(*s1 && *s2)
33
{
34
int
c1, c2;
35
c1 = (*ccl_toupper)(*s1);
36
c2 = (*ccl_toupper)(*s2);
37
if
(c1 != c2)
38
return
c1 - c2;
39
s1++;
40
s2++;
41
}
42
return
(*
ccl_toupper
)(*s1) - (*ccl_toupper)(*s2);
43
}
44
45
int
ccl_memicmp
(
const
char
*s1,
const
char
*s2,
size_t
n)
46
{
47
if
(!
ccl_toupper
)
48
ccl_toupper
=
ccli_toupper
;
49
while
(1)
50
{
51
int
c1, c2;
52
53
c1 = (*ccl_toupper)(*s1);
54
c2 = (*ccl_toupper)(*s2);
55
if
(n <= 1 || c1 != c2)
56
return
c1 - c2;
57
s1++;
58
s2++;
59
--n;
60
}
61
}
62
63
/*
64
* Local variables:
65
* c-basic-offset: 4
66
* c-file-style: "Stroustrup"
67
* indent-tabs-mode: nil
68
* End:
69
* vim: shiftwidth=4 tabstop=8 expandtab
70
*/
71
Generated on Wed May 15 2013 14:55:30 for YAZ by
1.8.1.2