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 Standards: ISO/IEC 9899:1999 (E) 12 */ 13 module nulib.c..string; 14 15 version (OSX) 16 version = Darwin; 17 else version (iOS) 18 version = Darwin; 19 else version (TVOS) 20 version = Darwin; 21 else version (WatchOS) 22 version = Darwin; 23 24 // Those libs don't expose the mandated C interface 25 version (CRuntime_Glibc) 26 version = ReturnStrerrorR; 27 else version (CRuntime_UClibc) 28 version = ReturnStrerrorR; 29 30 extern (C): 31 nothrow: 32 @nogc: 33 34 /// 35 inout(void)* memchr(return scope inout void* s, int c, size_t n) pure; 36 /// 37 int memcmp(scope const void* s1, scope const void* s2, size_t n) pure; 38 /// 39 void* memcpy(return scope void* s1, scope const void* s2, size_t n) pure; 40 version (Windows) { 41 /// 42 int memicmp(scope const char* s1, scope const char* s2, size_t n); 43 } 44 /// 45 void* memmove(return scope void* s1, scope const void* s2, size_t n) pure; 46 /// 47 void* memset(return scope void* s, int c, size_t n) pure; 48 49 /// 50 char* strcat(return scope char* s1, scope const char* s2) pure; 51 /// 52 inout(char)* strchr(return scope inout(char)* s, int c) pure; 53 /// 54 int strcmp(scope const char* s1, scope const char* s2) pure; 55 /// 56 int strcoll(scope const char* s1, scope const char* s2); 57 /// 58 char* strcpy(return scope char* s1, scope const char* s2) pure; 59 /// 60 size_t strcspn(scope const char* s1, scope const char* s2) pure; 61 /// 62 char* strdup(scope const char* s); 63 /// 64 char* strndup(scope const char* str, size_t size); 65 /// 66 char* strerror(int errnum); 67 // This `strerror_r` definition is not following the POSIX standard 68 version (ReturnStrerrorR) { 69 /// 70 const(char)* strerror_r(int errnum, return scope char* buf, size_t buflen); 71 } // This one is 72 else version (CRuntime_Newlib) { 73 /// 74 pragma(mangle, "__xpg_strerror_r") 75 int strerror_r(int errnum, scope char* buf, size_t buflen); 76 } else { 77 /// 78 int strerror_r(int errnum, scope char* buf, size_t buflen); 79 } 80 /// 81 size_t strlen(scope const char* s) pure; 82 /// 83 char* strncat(return scope char* s1, scope const char* s2, size_t n) pure; 84 /// 85 int strncmp(scope const char* s1, scope const char* s2, size_t n) pure; 86 /// 87 char* strncpy(return scope char* s1, scope const char* s2, size_t n) pure; 88 /// 89 inout(char)* strpbrk(return scope inout(char)* s1, scope const char* s2) pure; 90 /// 91 inout(char)* strrchr(return scope inout(char)* s, int c) pure; 92 /// 93 size_t strspn(scope const char* s1, scope const char* s2) pure; 94 /// 95 inout(char)* strstr(return scope inout(char)* s1, scope const char* s2) pure; 96 /// 97 char* strtok(return scope char* s1, scope const char* s2); 98 /// 99 size_t strxfrm(scope char* s1, scope const char* s2, size_t n);