3 * string.h compatibility shim
6 #ifndef LIBCRYPTOCOMPAT_STRING_H
7 #define LIBCRYPTOCOMPAT_STRING_H
11 #include <../ucrt/string.h>
13 #include <../include/string.h>
16 #include_next <string.h>
19 #include <sys/types.h>
21 #if defined(__sun) || defined(_AIX) || defined(__hpux)
22 /* Some functions historically defined in string.h were placed in strings.h by
23 * SUS. Use the same hack as OS X and FreeBSD use to work around on AIX,
29 #ifndef HAVE_STRCASECMP
30 int strcasecmp(const char *s1
, const char *s2
);
31 int strncasecmp(const char *s1
, const char *s2
, size_t len
);
35 size_t strlcpy(char *dst
, const char *src
, size_t siz
);
39 size_t strlcat(char *dst
, const char *src
, size_t siz
);
43 char * strndup(const char *str
, size_t maxlen
);
44 /* the only user of strnlen is strndup, so only build it if needed */
46 size_t strnlen(const char *str
, size_t maxlen
);
51 char *strsep(char **stringp
, const char *delim
);
54 #ifndef HAVE_EXPLICIT_BZERO
55 void explicit_bzero(void *, size_t);
58 #ifndef HAVE_TIMINGSAFE_BCMP
59 int timingsafe_bcmp(const void *b1
, const void *b2
, size_t n
);
62 #ifndef HAVE_TIMINGSAFE_MEMCMP
63 int timingsafe_memcmp(const void *b1
, const void *b2
, size_t len
);
67 void * memmem(const void *big
, size_t big_len
, const void *little
,
75 posix_strerror(int errnum
)
77 if (errnum
== ECONNREFUSED
) {
78 return "Connection refused";
80 return strerror(errnum
);
83 #define strerror(errnum) posix_strerror(errnum)