forked from cjdelisle/cjdns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCString.c
67 lines (56 loc) · 1.57 KB
/
CString.c
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
63
64
65
66
67
/* vim: set expandtab ts=4 sw=4: */
/*
* You may redistribute this program and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation,
* either version 3 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, see <https://www.gnu.org/licenses/>.
*/
#include "util/CString.h"
#include <string.h>
#if defined(Illumos) || defined(__sun)
#define _XPG4_2
#endif
#include <strings.h>
unsigned long CString_strlen(const char* str)
{
return strlen(str);
}
int CString_strcmp(const char* a, const char* b)
{
return strcmp(a,b);
}
int CString_strncmp(const char* a, const char *b, size_t n)
{
return strncmp(a, b, n);
}
char* CString_strchr(const char* a, int b)
{
return strchr(a,b);
}
char* CString_strrchr(const char* a, int b)
{
return strrchr(a,b);
}
int CString_strcasecmp(const char *a, const char *b)
{
return strcasecmp(a,b);
}
char* CString_strstr(const char* haystack, const char* needle)
{
return strstr(haystack,needle);
}
char* CString_strcpy(char* restrict dest, const char* restrict src)
{
return strcpy(dest, src);
}
char* CString_strncpy(char* restrict dest, const char *restrict src, size_t n)
{
return strncpy(dest, src, n);
}