xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/libdruntime/core/sys/posix/string.d (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 /**
2  * D header file for POSIX's <string.h>.
3  *
4  * Note:
5  * - The <string.h> header shall define NULL and size_t as described in <stddef.h>.
6  *   However, D has builtin `null` and `size_t` is defined in `object`.
7  *
8  * See_Also:  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/string.h.html
9  * Copyright: D Language Foundation, 2019
10  * License:   $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
11  * Authors:   Mathias 'Geod24' Lang
12  * Standards: The Open Group Base Specifications Issue 7, 2018 edition
13  * Source:    $(DRUNTIMESRC core/sys/posix/_string.d)
14  */
15 module core.sys.posix.string;
16 
17 version (Posix):
18 extern(C):
19 @system:
20 nothrow:
21 @nogc:
22 
23 /// Exposes `locale_t` as defined in `core.sys.posix.locale` (`<locale.h>`)
24 public import core.sys.posix.locale : locale_t;
25 
26 /**
27  * Exposes the C99 functions
28  *
29  * C extensions and XSI extensions are missing
30  */
31 public import core.stdc.string;
32 
33 /// Copy string until character found
34 void*  memccpy(return scope void* dst, scope const void* src, int c, size_t n) pure;
35 /// Copy string (including terminating '\0')
36 char*  stpcpy(return scope char* dst, scope const char* src) pure;
37 /// Ditto
38 char*  stpncpy(return scope char* dst, const char* src, size_t len) pure;
39 /// Compare strings according to current collation
40 int    strcoll_l(scope const char* s1, scope const char* s2, locale_t locale);
41 ///
42 char*  strerror_l(int, locale_t);
43 /// Save a copy of a string
44 char*  strndup(scope const char* str, size_t len);
45 /// Find length of string up to `maxlen`
46 size_t strnlen(scope const char* str, size_t maxlen) pure;
47 /// System signal messages
48 const(char)*  strsignal(int);
49 /// Isolate sequential tokens in a null-terminated string
50 char*  strtok_r(return scope char* str, scope const char* sep, char** context) pure;
51 /// Transform a string under locale
52 size_t strxfrm_l(char* s1, scope const char* s2, size_t n, locale_t locale);
53