summaryrefslogtreecommitdiff
path: root/pjlib/include/pj/compat/string.h
blob: fd0412304512af3292ff8cdfd35aeda37ec4c2d9 (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
/* $Id$ */
/* 
 * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 */
#ifndef __PJ_COMPAT_STRING_H__
#define __PJ_COMPAT_STRING_H__

/**
 * @file string.h
 * @brief Provides string manipulation functions found in ANSI string.h.
 */

#if defined(PJ_HAS_STRING_H) && PJ_HAS_STRING_H != 0
#  include <string.h>
#else

    PJ_DECL(int) strcasecmp(const char *s1, const char *s2);
    PJ_DECL(int) strncasecmp(const char *s1, const char *s2, int len);

#endif

#if defined(_MSC_VER)
#  define strcasecmp	stricmp
#  if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0
#   define strncasecmp	_strnicmp
#  else
#   define strncasecmp	strnicmp
#  endif
#  define snprintf	_snprintf
#else
#  define stricmp	strcasecmp
#  define strnicmp	strncasecmp
#endif


#define pj_native_strcmp        strcmp
#define pj_native_strncmp	strncmp
#define pj_native_strlen        strlen
#define pj_native_strcpy        strcpy
#define pj_native_strstr        strstr
#define pj_native_strchr        strchr
#define pj_native_strcasecmp    strcasecmp
#define pj_native_stricmp	strcasecmp
#define pj_native_strncasecmp   strncasecmp
#define pj_native_strnicmp	strncasecmp

#endif	/* __PJ_COMPAT_STRING_H__ */