summaryrefslogtreecommitdiff
path: root/helper/string.h
blob: 1f111ade49296a68759311c50b72c7e7f6db6ea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * Compatibility layer for string operations on different platforms.
 */

#ifndef __helper__string_h__
#define __helper__string_h__

#define _GNU_SOURCE

#include <gammu-config.h>

#include <string.h>

#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif


#ifndef HAVE_STRCASESTR
/**
 * Case insensitive substring location, libc compatibility.
 *
 * \ingroup Unicode
 */
extern char *strcasestr(const char *s, const char *find);
#endif

#ifndef HAVE_STRCASECMP
/**
 * Case insensitive string comparing, libc compatibility.
 *
 * \ingroup Unicode
 */
extern int strcasecmp(const char *s1, const char *s2);
#endif

#ifndef HAVE_STRCHRNUL
extern char *strchrnul(char *s, int find);
#endif

#ifndef HAVE_STRNCASECMP
#ifdef HAVE_STRNICMP
#define strncasecmp _strnicmp
#else
# define INTERNAL_STRNCASECMP
extern int strncasecmp (const char *s1, const char *s2, size_t n);
#endif
#endif

#ifndef HAVE_STRCASECMP
#ifdef HAVE_STRNICMP
#define strncasecmp _strnicmp
#else
# define INTERNAL_STRCASECMP
extern int strcasecmp (const char *s1, const char *s2);
#endif
#endif

#ifndef HAVE_TOWLOWER
wchar_t		towlower			(wchar_t c);
#endif
#endif