1 /**
2 * D header file for C99.
3 *
4 * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_string.h.html, _string.h)
5 *
6 * Copyright: Copyright Sean Kelly 2005 - 2009.
7 * License: Distributed under the
8 * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9 * (See accompanying file LICENSE)
10 * Authors: Sean Kelly
11 * Source: $(DRUNTIMESRC core/stdc/_string.d)
12 * Standards: ISO/IEC 9899:1999 (E)
13 */
14
15 module core.stdc.string;
16
17 version (OSX)
18 version = Darwin;
19 else version (iOS)
20 version = Darwin;
21 else version (TVOS)
22 version = Darwin;
23 else version (WatchOS)
24 version = Darwin;
25
26 // Those libs don't expose the mandated C interface
27 version (CRuntime_Glibc)
28 version = ReturnStrerrorR;
29 else version (CRuntime_UClibc)
30 version = ReturnStrerrorR;
31
32 extern (C):
33 @system:
34 nothrow:
35 @nogc:
36
37 ///
38 pure void* memchr(return const void* s, int c, size_t n);
39 ///
40 pure int memcmp(scope const void* s1, scope const void* s2, size_t n);
41 ///
42 pure void* memcpy(return void* s1, scope const void* s2, size_t n);
43 version (Windows)
44 {
45 ///
46 int memicmp(scope const char* s1, scope const char* s2, size_t n);
47 }
48 ///
49 pure void* memmove(return void* s1, scope const void* s2, size_t n);
cmpS50 ///
51 pure void* memset(return void* s, int c, size_t n);
52
53 ///
54 pure char* strcpy(return char* s1, scope const char* s2);
55 ///
56 pure char* strncpy(return char* s1, scope const char* s2, size_t n);
57 ///
58 pure char* strcat(return char* s1, scope const char* s2);
59 ///
60 pure char* strncat(return char* s1, scope const char* s2, size_t n);
61 ///
62 pure int strcmp(scope const char* s1, scope const char* s2);
63 ///
64 int strcoll(scope const char* s1, scope const char* s2);
65 ///
66 pure int strncmp(scope const char* s1, scope const char* s2, size_t n);
67 ///
68 size_t strxfrm(scope char* s1, scope const char* s2, size_t n);
69 ///
70 pure inout(char)* strchr(return inout(char)* s, int c);
71 ///
72 pure size_t strcspn(scope const char* s1, scope const char* s2);
73 ///
74 pure inout(char)* strpbrk(return inout(char)* s1, scope const char* s2);
75 ///
76 pure inout(char)* strrchr(return inout(char)* s, int c);
77 ///
78 pure size_t strspn(scope const char* s1, scope const char* s2);
79 ///
80 pure inout(char)* strstr(return inout(char)* s1, scope const char* s2);
81 ///
82 char* strtok(return char* s1, scope const char* s2);
83 ///
84 char* strerror(int errnum);
85 // This `strerror_r` definition is not following the POSIX standard
86 version (ReturnStrerrorR)
87 {
88 ///
89 const(char)* strerror_r(int errnum, return char* buf, size_t buflen);
90 }
91 // This one is
92 else
93 {
94 int strerror_r(int errnum, scope char* buf, size_t buflen);
95 }
96 ///
97 pure size_t strlen(scope const char* s);
98 ///
99 char* strdup(scope const char *s);
100