[tlbuild] strndup and strnlen in zziplib

Akira Kakuto kakuto at fuk.kindai.ac.jp
Wed Feb 28 01:33:00 CET 2018


Dear Guido,

We are reported that in some versions of Solaris,
both of strndup and strnlen are not included.
Thus we changed __string.h as follows in TeX Live:

--- __string.h.orig    Tue Feb 06 05:00:56 2018
+++ __string.h    Wed Feb 28 08:54:17 2018
@@ -18,6 +18,18 @@
#define _zzip_strndup strndup
#else

+#if defined(sun) || defined(__sun)
+static size_t  my_strnlen(const char*  str, size_t  maxlen)
+{
+    char *p = memchr(str, 0, maxlen);
+    if (p == NULL)
+       return maxlen;
+    else
+       return (p - str);
+}
+#define strnlen(x,y) my_strnlen((x),(y))
+#endif /* sun || __sun */
+
/* if your system does not have strndup: */
zzip__new__ static char *
_zzip_strndup(char const *p, size_t maxlen)

Best,
Akira



More information about the tlbuild mailing list